+Флаг на карте для синхронизированных обработок

This commit is contained in:
Igor I
2025-02-19 18:54:47 +05:00
parent be8a290d50
commit 0bfba422dc
6 changed files with 107 additions and 15 deletions

View File

@ -13,8 +13,8 @@ android {
defaultConfig {
applicationId "kz.istt.locust"
minSdkVersion 15
versionCode 106
versionName "3.0.3"
versionCode 108
versionName "3.0.5"
targetSdkVersion 34
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

View File

@ -63,7 +63,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
ArrayList<Polygon> polygons=new ArrayList<Polygon>();
Polygon polygon=null;
String uid="";
String g_uid="";
private Marker marker=null;
private LocationManager lm;
@ -97,10 +97,10 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
Intent intent = getIntent();
points = intent.getParcelableArrayListExtra("LatLon");
uid = intent.getStringExtra("uid");
g_uid = intent.getStringExtra("uid");
if(g_uid==null) g_uid="";
// Чтоб слушать GPS
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
@ -131,7 +131,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
);
marker.setVisible(false);
//Геозоны обследования саранчи
//Отобразить все геозоны кроме текущей, обследования саранчи (текущие ниже)
DbOpenHelper dboh = new DbOpenHelper(this);
SQLiteDatabase rdb = null;
try {
@ -139,12 +139,25 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
rdb = dboh.getReadableDatabase();
Cursor cursor=null;
try {
cursor = rdb.rawQuery("select frmlocust_uid,lat,lon from frmlocust_locations where frmlocust_uid!='" + uid + "' order by frmlocust_uid,pos;", null);
String sql = """
select
frmlocust_uid,
lat,
lon
from
frmlocust_locations
where
frmlocust_uid!=?
order by
frmlocust_uid,
pos
""";
cursor = rdb.rawQuery(sql, new String[]{g_uid});
if (cursor.moveToFirst()) {
String uid = "";
PolygonOptions pOptions2 = new PolygonOptions();
do {
if (!uid.equals(cursor.getString(0)) && pOptions2.getPoints().size() > 1) {
if (pOptions2.getPoints().size() > 1) {
Polygon polygon = mMap.addPolygon(pOptions2);
polygons.add(polygon);
polygon.setFillColor(0x7F0000FF);
@ -155,6 +168,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
}
pOptions2.add(new LatLng(cursor.getDouble(1), cursor.getDouble(2)));
} while (cursor.moveToNext());
if (pOptions2.getPoints().size() > 1) {
Polygon polygon = mMap.addPolygon(pOptions2);
polygons.add(polygon);
@ -167,10 +181,23 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
if(cursor!=null){ cursor.close(); }
}
//Геозоны противосаначовой обработки
//Отобразить все геозоны кроме текущей, противосаначовой обработки (текущие ниже)
cursor=null;
try {
cursor = rdb.rawQuery("select frmlocustdel_uid,lat,lon from frmlocustdel_locations where frmlocustdel_uid!='" + uid + "' order by frmlocustdel_uid,pos;", null);
String sql = """
select
frmlocustdel_uid,
lat,
lon
from
frmlocustdel_locations
where
frmlocustdel_uid!=?
order by
frmlocustdel_uid,
pos
""";
cursor = rdb.rawQuery(sql, new String[]{g_uid});
if (cursor.moveToFirst()) {
String uid = "";
PolygonOptions pOptions2 = new PolygonOptions();
@ -198,6 +225,40 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
if(cursor!=null){ cursor.close(); }
}
//Отображаю все центральные точки с анкет противосаранчовой обработки
cursor=null;
try {
String sql = """
select
uid,
lat_center,
lon_center
from
frmlocustdel
where
del = 0
and uid!=?
""";
cursor = rdb.rawQuery(sql, new String[]{g_uid});
if (cursor.moveToFirst()) {
do {
center = new LatLng(cursor.getDouble(1), cursor.getDouble(2));
mMap.addMarker(new MarkerOptions()
.position(center)
.title("Spray")
.icon(BitmapDescriptorFactory.fromBitmap(getMarker(R.drawable.ic_flag)))
);
} while (cursor.moveToNext());
}
}catch(Exception e){
e.printStackTrace();
}finally{
if(cursor!=null){ cursor.close(); }
}
}catch(Exception e){
e.printStackTrace();
}finally{
@ -205,7 +266,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
}
dboh.close();
/**/
//Сreating a polygon. (The main polygon at the end since they overlap each)
//Create a geopolygon for the current survey. (The main polygon at the end since they overlap each)
PolygonOptions pOptions = new PolygonOptions();
for(int i=0;i<points.size();i++){
@ -213,7 +274,7 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
pOptions.add(new LatLng(points.get(i).lat, points.get(i).lon));
}
if(pOptions.getPoints().size()>0) {
if(!pOptions.getPoints().isEmpty()) {
Polygon polygon = mMap.addPolygon(pOptions);
polygon.setFillColor(0x7F00FF00);
center = getPolygonCenterPoint(pOptions.getPoints());

View File

@ -14,6 +14,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
@ -32,6 +33,8 @@ import com.google.android.gms.vision.barcode.BarcodeDetector;
import java.util.Locale;
import dbfields.InputFilterMinMax;
public class SetupActivity extends Activity {
@ -344,6 +347,7 @@ public class SetupActivity extends Activity {
});
edtSyncDays = (EditText) findViewById(R.id.edtSyncDays);
edtSyncDays.setFilters(new InputFilter[]{ new InputFilterMinMax(1, 365) });
edtSyncDays.setText(String.valueOf(MySynchronizationOld.SyncDays));
edtSyncDays.addTextChangedListener(new TextWatcher() {

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="25dp"
android:height="32dp"
android:viewportWidth="25"
android:viewportHeight="32.091168">
<!-- Палка флага -->
<path
android:strokeWidth="1.90167"
android:strokeColor="#000000"
android:fillColor="#000000"
android:strokeLineCap="round"
android:pathData="M5.0213123,29.152388 V2.8006687" />
<!-- Полотнище флага -->
<path
android:strokeWidth="0.614869"
android:strokeColor="#000000"
android:fillColor="#2A2AFF"
android:strokeLineJoin="round"
android:pathData="M5.6552021,4.0684492 C11.994103,6.7851209 15.072998,6.6040094 21.774124,4.2495607 C19.872453,8.052901 19.872453,10.950685 21.774124,14.754026 C15.254111,17.017919 12.627995,17.017919 5.6552021,14.754026 Z" />
</vector>

View File

@ -1,5 +1,9 @@
<vector android:height="48dp" android:viewportHeight="128"
android:viewportWidth="128" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<vector
android:height="48dp"
android:viewportHeight="128"
android:viewportWidth="128"
android:width="48dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#2d3e50"
android:pathData="M64.002,3.367c-25.749,0 -43.05,14.759 -43.05,36.725 0,29.112 37.015,81.601 37.383,82.011a7.603,7.603 0,0 0,11.323 0.006c0.374,-0.416 37.389,-52.905 37.389,-82.017C107.048,18.125 89.749,3.367 64.002,3.367ZM64,74.739a28.296,28.296 0,1 1,28.296 -28.296A28.296,28.296 0,0 1,64 74.739Z"
android:strokeColor="#ffc6ff" android:strokeWidth="3.8"/>

View File

@ -281,7 +281,7 @@
android:autofillHints=""
android:ems="10"
android:importantForAutofill="no"
android:inputType="numberDecimal" />
android:inputType="number" />
</LinearLayout>
<LinearLayout