添加两点测距函数,优化地图标点相关

chiyanzhen_branch
CYZ 2 years ago
parent 7d2ee4d25e
commit 008d0d92d7

Binary file not shown.

@ -1,31 +1,31 @@
C
java:S1604;"(Make this anonymous inner class a lambda(ƒø…Òÿÿÿÿÿ
java:S1604Z"(Make this anonymous inner class a lambda(ƒø…Òÿÿÿÿÿ
>
java:S1604D"(Make this anonymous inner class a lambda(›³äª
o java:S115!"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(××ðè
t java:S115""ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(Ó<EFBFBD><EFBFBD>ïùÿÿÿÿ
t java:S1160"ZRename this field "Trans_to_Detect" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¾¥Âöûÿÿÿÿ
java:S1604c"(Make this anonymous inner class a lambda(›³äª
t java:S115!"ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(­“ïÍøÿÿÿÿ
o java:S115""ZRename this constant name to match the regular expression '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.(šŸåå
t java:S116O"ZRename this field "Trans_to_Detect" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¾¥Âöûÿÿÿÿ
y
java:S14500"^Remove the "Trans_to_Detect" field and declare it as a local variable in the relevant methods.(¾¥Âöûÿÿÿÿ
java:S1450O"^Remove the "Trans_to_Detect" field and declare it as a local variable in the relevant methods.(¾¥Âöûÿÿÿÿ
m
java:S14502"RRemove the "btn" field and declare it as a local variable in the relevant methods.(ãȧ<C388>üÿÿÿÿ
[
java:S1124!"EReorder the modifiers to comply with the Java Language Specification.(××ðè
java:S1450Q"RRemove the "btn" field and declare it as a local variable in the relevant methods.(ãȧ<C388>üÿÿÿÿ
`
java:S1124""EReorder the modifiers to comply with the Java Language Specification.(Ó<><C393>ïùÿÿÿÿ
java:S1124!"EReorder the modifiers to comply with the Java Language Specification.(­“ïÍøÿÿÿÿ
[
java:S1124""EReorder the modifiers to comply with the Java Language Specification.(šŸåå
[
java:S1124#"EReorder the modifiers to comply with the Java Language Specification.(ß×á
[
java:S1124$"EReorder the modifiers to comply with the Java Language Specification.(Ó¾þá
V java:S125>"<This block of commented-out lines of code should be removed.(è·¿¯ùÿÿÿÿ
V java:S125]"<This block of commented-out lines of code should be removed.(è·¿¯ùÿÿÿÿ
C
java:S1185_"(Remove this method to simply inherit it.(ñ‰ÿÜýÿÿÿÿ
V java:S125r"<This block of commented-out lines of code should be removed.(<28>­éäøÿÿÿÿ
V java:S125w"<This block of commented-out lines of code should be removed.(çéŸþÿÿÿÿ
E
java:S2093n"*Change this "try" to a try-with-resources.(ç£ê<C2A3>úÿÿÿÿ
W java:S125®"<This block of commented-out lines of code should be removed.(òœô˜úÿÿÿÿ
java:S1185~"(Remove this method to simply inherit it.(ñ‰ÿÜýÿÿÿÿ
W java:S125"<This block of commented-out lines of code should be removed.(<28>­éäøÿÿÿÿ
W java:S125"<This block of commented-out lines of code should be removed.(çéŸþÿÿÿÿ
F
java:S2093<EFBFBD>"*Change this "try" to a try-with-resources.(ç£ê<C2A3>úÿÿÿÿ
W java:S125Í"<This block of commented-out lines of code should be removed.(òœô˜úÿÿÿÿ
9
java:S1128"Remove this duplicated import.(°þÊóøÿÿÿÿ
L

@ -1,51 +1,54 @@
p
java:S11047"[Make mLocationClient a static final constant or non-public and provide accessors if needed.(òó•L
java:S11049"[Make mLocationClient a static final constant or non-public and provide accessors if needed.(òó•L
q
java:S11049"[Make mLocationOption a static final constant or non-public and provide accessors if needed.(ÈÀ‚§
java:S1104;"[Make mLocationOption a static final constant or non-public and provide accessors if needed.(ÈÀ‚§
k
java:S2259ã"MA "NullPointerException" could be thrown; "mLocationClient" is nullable here.(Ô¹¤<C2B9>8˜¡ØÑö0
o java:S116M"ZRename this field "ClearMarker_btn" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ëþ¥È
y java:S116O"XRename this field "ChangeAct_btn" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÂîœÃúÿÿÿÿ8…ÚÑö0
java:S2259ê"MA "NullPointerException" could be thrown; "mLocationClient" is nullable here.(Ô¹¤<C2B9>8üÀ±•‡1
z java:S116>"YRename this field "Current_latlng" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(æàÁÆÿÿÿÿÿ8ýÀ±•‡1
v java:S116P"ZRename this field "ClearMarker_btn" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ëþ¥È8ýÀ±•‡1
y java:S116R"XRename this field "ChangeAct_btn" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÂîœÃúÿÿÿÿ8ýÀ±•‡1
Ÿ
java:S1186"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(±€¿ë8 ¡ØÑö0
java:S1186Å"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(±€¿ë8Á±•‡1
~
java:S1450O"\Remove the "ChangeAct_btn" field and declare it as a local variable in the relevant methods.(ÂîœÃúÿÿÿÿ8ÏýÚÑö0
java:S1450R"\Remove the "ChangeAct_btn" field and declare it as a local variable in the relevant methods.(ÂîœÃúÿÿÿÿ8ƒÁ±•‡1
i
java:S1450;"SRemove the "city" field and declare it as a local variable in the relevant methods.(“øÌà
m
java:S1450I"WRemove the "cityCode" field and declare it as a local variable in the relevant methods.(êýð†
G
java:S1874E"1Remove this use of "PoiSearch"; it is deprecated.(–ƒëÖ
L
java:S1874G"1Remove this use of "PoiSearch"; it is deprecated.(²¹·‘ÿÿÿÿÿ
] java:S125b"<This block of commented-out lines of code should be removed.(¤¯¿Îúÿÿÿÿ8°¡ØÑö0
java:S1450="SRemove the "city" field and declare it as a local variable in the relevant methods.(“øÌà
t
java:S1450L"WRemove the "cityCode" field and declare it as a local variable in the relevant methods.(êýð†8ƒÁ±•‡1
N
java:S1874H"1Remove this use of "PoiSearch"; it is deprecated.(–ƒëÖ8ŒÁ±•‡1
S
java:S1874J"1Remove this use of "PoiSearch"; it is deprecated.(²¹·‘ÿÿÿÿÿ8<EFBFBD>Á±•‡1
] java:S125e"<This block of commented-out lines of code should be removed.(¤¯¿Îúÿÿÿÿ8˜Á±•‡1
m
java:S1874<EFBFBD>"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(Ó»×¶þÿÿÿÿ8¸¡ØÑö0
Y java:S125Ï"<This block of commented-out lines of code should be removed.(©áèè8À¡ØÑö0
java:S1874 "JDon't override a deprecated method or explicitly mark it as "@Deprecated".(Ó»×¶þÿÿÿÿ8œÁ±•‡1
Y java:S125Ö"<This block of commented-out lines of code should be removed.(©áèè8¤Á±•‡1
`
java:S1854"=Remove this useless assignment to local variable "longitude".(ËàÅ€ûÿÿÿÿ8È¡ØÑö0
java:S1854"=Remove this useless assignment to local variable "longitude".(ËàÅ€ûÿÿÿÿ8¨Á±•‡1
_
java:S1854þ"<Remove this useless assignment to local variable "latitude".(û‘áäùÿÿÿÿ8È¡ØÑö0
java:S1854"<Remove this useless assignment to local variable "latitude".(û‘áäùÿÿÿÿ8©Á±•‡1
P
java:S1481þ"-Remove this unused "latitude" local variable.(û‘áäùÿÿÿÿ8È¡ØÑö0
java:S1481"-Remove this unused "latitude" local variable.(û‘áäùÿÿÿÿ8«Á±•‡1
Q
java:S1481".Remove this unused "longitude" local variable.(ËàÅ€ûÿÿÿÿ8È¡ØÑö0
java:S1481".Remove this unused "longitude" local variable.(ËàÅ€ûÿÿÿÿ8«Á±•‡1
Y java:S125Ä"<This block of commented-out lines of code should be removed.(É–Ö­8ÔŸÈ•‡1
N
java:S1172Ù"+Remove this unused method parameter "view".(çÑ¢‰ýÿÿÿÿ8СØÑö0
java:S1172ç"+Remove this unused method parameter "view".(çÑ¢‰ýÿÿÿÿ8²Á±•‡1
\
java:S1155Ú">Use isEmpty() to check whether the collection is empty or not.(”ó±’8СØÑö0
java:S1155è">Use isEmpty() to check whether the collection is empty or not.(”ó±’8²Á±•‡1
N
java:S1172â"+Remove this unused method parameter "view".(•É‘ÎûÿÿÿÿèÑö0
java:S1172ð"+Remove this unused method parameter "view".(•É‘Îûÿÿÿÿ8³Á±•‡1
X java:S125"<This block of commented-out lines of code should be removed.(Ÿ…¦Q8¸Á±•‡1
\
java:S1117ñ"9Rename "query" which hides the field declared at line 69.(˜Ž“áûÿÿÿÿ8Ø¡ØÑö0
^ java:S125Š"<This block of commented-out lines of code should be removed.(±<>öîýÿÿÿÿ8Ø¡ØÑö0
Y java:S125"<This block of commented-out lines of code should be removed.(ÎÞ<C38E>û8Ø¡ØÑö0
java:S1117±"9Rename "query" which hides the field declared at line 72.(˜Ž“áûÿÿÿÿ8»Á±•‡1
^ java:S125Ê"<This block of commented-out lines of code should be removed.(±<>öîýÿÿÿÿ8½Á±•‡1
Y java:S125Õ"<This block of commented-out lines of code should be removed.(ÎÞ<C38E>û8½Á±•‡1
>
java:S1068;"(Remove this unused "city" private field.(“øÌà
?
java:S1068E")Remove this unused "query" private field.(–ƒëÖ
H
java:S1068G"-Remove this unused "poiSearch" private field.(²¹·‘ÿÿÿÿÿ
B
java:S1068I",Remove this unused "cityCode" private field.(êýð†
java:S1068="(Remove this unused "city" private field.(“øÌà
F
java:S1068H")Remove this unused "query" private field.(–ƒëÖ8¾Á±•‡1
O
java:S1068J"-Remove this unused "poiSearch" private field.(²¹·‘ÿÿÿÿÿ8¾Á±•‡1
I
java:S1068L",Remove this unused "cityCode" private field.(êýð†8¾Á±•‡1

@ -10,9 +10,9 @@ java:S1604
i
java:S1104%"SMake TV_show a static final constant or non-public and provide accessors if needed.(úÀŸõ
>
java:S2189±""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ
>
java:S2189""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ
>
java:S2189±""Add an end condition to this loop.(˜ïˆžÿÿÿÿÿ
k java:S116!"VRename this field "receive_Msg" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ŒßÙú
g java:S116%"RRename this field "TV_show" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(úÀŸõ
^

@ -17,11 +17,11 @@ j
settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233
P
app/src/main/AndroidManifest.xml,8\c\8c55c3ccc257e5907959013f99656e4c8ec3903e
i
9app/src/main/java/com/example/sixaunyi/VideoActivity.java,7\1\71fd1993763df2214bbdad8cfee650733993fe44
h
8app/src/main/java/com/example/sixaunyi/MainActivity.java,7\c\7c120b7216f76ce98d1573d90803ab36f481640c
@
app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164
j
:app/src/main/java/com/example/sixaunyi/DetectActivity.java,9\6\9668392b13e33166876f2a7d3f10eb5405e757ad
h
8app/src/main/java/com/example/sixaunyi/MainActivity.java,7\c\7c120b7216f76ce98d1573d90803ab36f481640c
i
9app/src/main/java/com/example/sixaunyi/VideoActivity.java,7\1\71fd1993763df2214bbdad8cfee650733993fe44

@ -22,6 +22,7 @@ import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps.AMap;
import com.amap.api.maps.AMapUtils;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.MapView;
import com.amap.api.maps.model.BitmapDescriptorFactory;
@ -47,7 +48,8 @@ import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
public class MainActivity extends AppCompatActivity implements AMapLocationListener, LocationSource,
AMap.OnMapLongClickListener, GeocodeSearch.OnGeocodeSearchListener {
AMap.OnMapLongClickListener, GeocodeSearch.OnGeocodeSearchListener, AMap.OnMarkerDragListener,
AMap.OnMarkerClickListener{
//请求权限码
private static final int REQUEST_PERMISSIONS = 9527;
@ -57,6 +59,7 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
public AMapLocationClientOption mLocationOption = null;
private MapView mapView = null;
private String city;
private LatLng Current_latlng;
//地图控制器*********非常重要!!!!!!
private AMap aMap = null;
//位置更改监听
@ -203,6 +206,10 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
aMap.setLocationSource(this);
// 设置为true表示显示定位层并可触发定位false表示隐藏定位层并不可触发定位默认是false
aMap.setMyLocationEnabled(true);
//设置地图标志点击事件
aMap.setOnMarkerClickListener(this);
//设置地图标志拖拽事件
aMap.setOnMarkerDragListener(this);
//开启室内地图
//aMap.showIndoorMap(true);
//设置地图长按事件
@ -250,6 +257,8 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
String address = aMapLocation.getAddress();
//城市赋值
city = aMapLocation.getCity();
//当前位置经纬度坐标
Current_latlng = new LatLng(aMapLocation.getLatitude(), aMapLocation.getLongitude());
//获取纬度
double latitude = aMapLocation.getLatitude();
//获取经度
@ -311,7 +320,9 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
//LatLng 为高德地图包自带的存储坐标对象
@Override
public void onMapLongClick(LatLng latLng) {
showMsg("长按了地图,经度:"+latLng.longitude+",纬度:"+latLng.latitude);
float distance = AMapUtils.calculateLineDistance(Current_latlng,latLng);
//showMsg("长按了地图,经度:"+latLng.longitude+",纬度:"+latLng.latitude);
showMsg("直线距离:"+distance+"米");
//坐标转地址
latlonToAddress(latLng);
//添加标点
@ -329,13 +340,16 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
//添加标点
Marker marker = aMap.addMarker(markerOption
.position(latLng)
.draggable(true)
//标点图标
.icon(BitmapDescriptorFactory.
fromBitmap(BitmapFactory.decodeResource(getResources(),R.drawable.img)))
//备注
.snippet("路径点")
.title("路径点")
.snippet("距离:")
);
marker.showInfoWindow();
markerList.add(marker);
}
/**
@ -358,6 +372,56 @@ public class MainActivity extends AppCompatActivity implements AMapLocationListe
}
/**
* Marker
*
* @param marker
* @return
*/
@Override
public boolean onMarkerClick(Marker marker) {
Log.d(TAG,"点击了标点");
//显示InfoWindow
/*
if (!marker.isInfoWindowShown()) {
//显示
marker.showInfoWindow();
} else {
//隐藏
marker.hideInfoWindow();
}
*/
return true;
}
/**
*
* @param marker
*/
@Override
public void onMarkerDragStart(Marker marker) {
Log.d(TAG,"开始拖动");
}
/**
*
* @param marker
*/
@Override
public void onMarkerDrag(Marker marker) {
Log.d(TAG,"拖动中");
}
/**
*
* @param marker
*/
@Override
public void onMarkerDragEnd(Marker marker) {
Log.d(TAG,"拖动完成");
}
/* * * * * *
*
* @param latLng

@ -30,8 +30,8 @@ import android.os.Bundle;
public class VideoActivity extends AppCompatActivity {
private final static String SEND_to_IP = "192.168.10.2"; //填写接收方IP
private final static String Recieve_IP = "192.168.10.2";//填服务器IP
private final static String SEND_to_IP = "192.168.43.165"; //填写接收方IP
private final static String Recieve_IP = "192.168.43.165";//填服务器IP
private final static int SEND_PORT = 8888; //发送端口号
private final static int RECEIVE_PORT = 9999; //接收端口号
@ -44,6 +44,37 @@ public class VideoActivity extends AppCompatActivity {
private DatagramSocket reveSocket;
private InetAddress serverAddr;
private SendHandler sendHandler = new SendHandler();
private ReceiveHandler receiveHandler = new ReceiveHandler();
private Button Trans_to_Detect;
private ImageView imgShow;

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:adjustViewBounds="true" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff000000"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff7f7f7f"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/img"
android:orientation="horizontal" >
<ImageView
android:id="@+id/badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff000000"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:id="@+id/snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff7f7f7f"
android:textSize="14dp" />
</LinearLayout>
</LinearLayout>
Loading…
Cancel
Save