区域定位java代码实现 区域定位java代码实现方法

java简单定位及位子确定的代码具体看补充

(3,4,N)

在吴中等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、成都做网站 网站设计制作按需开发,公司网站建设,企业网站建设,品牌网站设计,全网营销推广,成都外贸网站建设,吴中网站建设费用合理。

上北下南左西又东

顺时针排序:北东南西

北1 东2 南3 西4

(3,4,1)

左转1+1=2东

右转1-1=01,则0=4西

后转1+2=3南

可以把朝向问题看成类似约瑟夫的问题。

用数组记录当前坐标X Y 及朝向。用1,2,3,4代表北东南西

左转后,(3,4,2)

往前一步,

当朝向不同的时候,有对应的向前向后是改变哪个坐标值,

写四个朝向时候的坐标的算法

然后调用,传入2,则调用case=2时的动作,如果向前则~~~向后则~~~~再命令转向则(调用处理方向改变的函数)~~~~

最后输出(,,),对最后一个兑换成“东南西北”输出就行了

()

java如何实现电子地图的定位

CellInfoManager

import java.lang.reflect.Method;

import java.util.Iterator;

import java.util.List;

import org.json.JSONArray;

import org.json.JSONException;

import org.json.JSONObject;

import android.content.Context;

import android.telephony.CellLocation;

import android.telephony.NeighboringCellInfo;

import android.telephony.PhoneStateListener;

import android.telephony.TelephonyManager;

import android.telephony.gsm.GsmCellLocation;

import android.util.Log;

public class CellInfoManager {

private int asu;

private int bid;

private int cid;

private boolean isCdma;

private boolean isGsm;

private int lac;

private int lat;

private final PhoneStateListener listener;

private int lng;

private int mcc;

private int mnc;

private int nid;

private int sid;

private TelephonyManager tel;

private boolean valid;

private Context context;

public CellInfoManager(Context paramContext) {

this.listener = new CellInfoListener(this);

tel = (TelephonyManager) paramContext.getSystemService(Context.TELEPHONY_SERVICE);

this.tel.listen(this.listener, PhoneStateListener.LISTEN_CELL_LOCATION | PhoneStateListener.LISTEN_SIGNAL_STRENGTH);

context = paramContext;

}

public static int dBm(int i) {

int j;

if (i = 0 i = 31)

j = i * 2 + -113;

else

j = 0;

return j;

}

public int asu() {

return this.asu;

}

public int bid() {

if (!this.valid)

update();

return this.bid;

}

public JSONObject cdmaInfo() {

if (!isCdma()) {

return null;

}

JSONObject jsonObject = new JSONObject();

try {

jsonObject.put("bid", bid());

jsonObject.put("sid", sid());

jsonObject.put("nid", nid());

jsonObject.put("lat", lat());

jsonObject.put("lng", lng());

} catch (JSONException ex) {

jsonObject = null;

Log.e("CellInfoManager", ex.getMessage());

}

return jsonObject;

}

public JSONArray cellTowers() {

JSONArray jsonarray = new JSONArray();

int lat;

int mcc;

int mnc;

int aryCell[] = dumpCells();

lat = lac();

mcc = mcc();

mnc = mnc();

if (aryCell == null || aryCell.length 2) {

aryCell = new int[2];

aryCell[0] = cid;

aryCell[1] = -60;

}

for (int i = 0; i aryCell.length; i += 2) {

try {

int j2 = dBm(i + 1);

JSONObject jsonobject = new JSONObject();

jsonobject.put("cell_id", aryCell[i]);

jsonobject.put("location_area_code", lat);

jsonobject.put("mobile_country_code", mcc);

jsonobject.put("mobile_network_code", mnc);

jsonobject.put("signal_strength", j2);

jsonobject.put("age", 0);

jsonarray.put(jsonobject);

} catch (Exception ex) {

ex.printStackTrace();

Log.e("CellInfoManager", ex.getMessage());

}

}

if (isCdma())

jsonarray = new JSONArray();

return jsonarray;

}

public int cid() {

if (!this.valid)

update();

return this.cid;

}

public int[] dumpCells() {

int[] aryCells;

if (cid() == 0) {

aryCells = new int[0];

return aryCells;

}

ListNeighboringCellInfo lsCellInfo = this.tel.getNeighboringCellInfo();

if (lsCellInfo == null || lsCellInfo.size() == 0) {

aryCells = new int[1];

int i = cid();

aryCells[0] = i;

检举补充回答:

return aryCells;

}

int[] arrayOfInt1 = new int[lsCellInfo.size() * 2 + 2];

int j = 0 + 1;

int k = cid();

arrayOfInt1[0] = k;

int m = j + 1;

int n = asu();

arrayOfInt1[j] = n;

IteratorNeighboringCellInfo iter = lsCellInfo.iterator();

while (true) {

if (!iter.hasNext()) {

break;

}

NeighboringCellInfo localNeighboringCellInfo = (NeighboringCellInfo) iter.next();

int i2 = localNeighboringCellInfo.getCid();

if ((i2 = 0) || (i2 == 65535))

continue;

int i3 = m + 1;

arrayOfInt1[m] = i2;

m = i3 + 1;

int i4 = localNeighboringCellInfo.getRssi();

arrayOfInt1[i3] = i4;

}

int[] arrayOfInt2 = new int[m];

System.arraycopy(arrayOfInt1, 0, arrayOfInt2, 0, m);

aryCells = arrayOfInt2;

return aryCells;

}

public JSONObject gsmInfo() {

if (!isGsm()) {

return null;

}

JSONObject localObject = null;

while (true) {

try {

检举补充回答: JSONObject localJSONObject1 = new JSONObject();

String str1 = this.tel.getNetworkOperatorName();

localJSONObject1.put("operator", str1);

String str2 = this.tel.getNetworkOperator();

if ((str2.length() == 5) || (str2.length() == 6)) {

String str3 = str2.substring(0, 3);

String str4 = str2.substring(3, str2.length());

localJSONObject1.put("mcc", str3);

localJSONObject1.put("mnc", str4);

}

localJSONObject1.put("lac", lac());

int[] arrayOfInt = dumpCells();

JSONArray localJSONArray1 = new JSONArray();

int k = 0;

int m = arrayOfInt.length / 2;

while (true) {

if (k = m) {

localJSONObject1.put("cells", localJSONArray1);

localObject = localJSONObject1;

break;

}

int n = k * 2;

int i1 = arrayOfInt[n];

int i2 = k * 2 + 1;

int i3 = arrayOfInt[i2];

JSONObject localJSONObject7 = new JSONObject();

localJSONObject7.put("cid", i1);

localJSONObject7.put("asu", i3);

localJSONArray1.put(localJSONObject7);

k += 1;

}

} catch (JSONException localJSONException) {

localObject = null;

}

}

}

public boolean isCdma() {

if (!this.valid)

update();

如何用java实现“通过根据给定的经纬度生成区域”?

使用第三方jar包 jts包 例子如下面 \x0d\x0a\x0d\x0a//一个面所包含的经纬度(标准的经纬*3600000) \x0d\x0aString str = "POLYGON ((419164412 143703543, 419164481 143702737, 419164494 143702527,419164412 143703543))"; \x0d\x0aWKTReader wkt = new WKTReader(); \x0d\x0aGeometry geojudge1 = wkt.read(str); \x0d\x0aint xpoi = 419164481; \x0d\x0aint ypoi = 143702737; \x0d\x0aGeometry geojudge2 = wkt.read("POINT(" + xpoi + " " + ypoi + "))"); \x0d\x0a\x0d\x0aif(geojudge1.intersects(geojudge2)) { \x0d\x0aSystem.out.println("xpoi、ypoi 在这个面里"); \x0d\x0a} \x0d\x0a\x0d\x0aps:在构成一个面的时候,第一个点的经纬度一定要与最后一个点的经纬度相同。否则会报错误:java.lang.IllegalArgumentException: points must form a closed linestring


标题名称:区域定位java代码实现 区域定位java代码实现方法
本文链接:http://hbruida.cn/article/dogsigh.html