Java Code Examples for com.google.android.gms.maps.model.Marker#setTag()

The following examples show how to use com.google.android.gms.maps.model.Marker#setTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void setAiLineMarkByHistory(List<X8AiLinePointLatlngInfo> points, int mapTpye) {
    for (X8AiLinePointLatlngInfo point : points) {
        int res;
        MapPointLatLng mp = new MapPointLatLng();
        if (point.getYawMode() == 0) {
            res = R.drawable.x8_ai_line_point_no_angle2;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        BitmapDescriptor mBitmapDescriptor = this.gdCustemMarkerView.createCustomMarkerView2(this.context, res, this.mMarkerList.size() + 1);
        mp.altitude = (float) point.getAltitude();
        mp.nPos = this.mMarkerList.size() + 1;
        LatLng latLng = new LatLng(point.getLatitude(), point.getLongitude());
        Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
        mp.longitude = latLng.longitude;
        mp.latitude = latLng.latitude;
        mMarker.setFlat(true);
        mMarker.setTag(mp);
        this.mMarkerList.add(mMarker);
        mp.distance = 0.0f;
        this.mMapPointList.add(mp);
    }
    if (points.size() > 0) {
        drawPointLine(this.gglMapLocationManager.getDevLocation());
    }
}
 
Example 2
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void addSmallMakerByMap1(Marker marker1, Marker marker2) {
    MapPointLatLng mpl1 = (MapPointLatLng) marker1.getTag();
    MapPointLatLng mpl2 = (MapPointLatLng) marker2.getTag();
    LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(marker1.getPosition(), marker2.getPosition(), 3);
    mpl2.setAngle(getPointAngle(mpl1, mpl2));
    mpl2.yawMode = this.lineMarkerSelectListener.getOration();
    float[] angleArray = new float[]{mpl2.showAngle, mpl2.showAngle};
    for (int i = 0; i < latLng.length; i++) {
        MapPointLatLng mpl = new MapPointLatLng();
        mpl.isSelect = true;
        mpl.setAngle(angleArray[i]);
        Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
        mMarker.setTag(mpl);
        mMarker.setFlat(true);
        this.arrowMarkerList.add(mMarker);
    }
}
 
Example 3
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void addSmallMaker(Marker marker1, Marker marker2) {
    MapPointLatLng mpl1 = (MapPointLatLng) marker1.getTag();
    MapPointLatLng mpl2 = (MapPointLatLng) marker2.getTag();
    if (mpl1.yawMode != 0) {
        LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(marker1.getPosition(), marker2.getPosition(), 3);
        float[] angleArray = new float[2];
        if (mpl1.yawMode == 2) {
            mpl2.showAngle = getPointAngle(mpl1, mpl2);
            angleArray[0] = mpl2.showAngle;
            angleArray[1] = mpl2.showAngle;
        } else if (mpl1.yawMode == 1) {
            angleArray = this.mapCalcAngle.getAnlgesByRoration(mpl1.showAngle, mpl2.showAngle, mpl2.roration);
        }
        for (int i = 0; i < latLng.length; i++) {
            MapPointLatLng mpl = new MapPointLatLng();
            mpl.isSelect = true;
            mpl.setAngle(angleArray[i]);
            Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
            mMarker.setTag(mpl);
            mMarker.setFlat(true);
            this.arrowMarkerList.add(mMarker);
        }
    }
}
 
Example 4
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void addOrUpdateSmallMarkerForVideo(int type) {
    clearAllSmallMarker();
    int j = 0;
    for (Marker marker : this.mMarkerList) {
        MapPointLatLng p = (MapPointLatLng) marker.getTag();
        if (j != 0) {
            MapPointLatLng mpl2 = (MapPointLatLng) ((Marker) this.mMarkerList.get(j)).getTag();
            LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(((Marker) this.mMarkerList.get(j - 1)).getPosition(), ((Marker) this.mMarkerList.get(j)).getPosition(), 3);
            float[] angleArray = new float[]{mpl2.showAngle, mpl2.showAngle};
            for (int i = 0; i < latLng.length; i++) {
                MapPointLatLng mpl = new MapPointLatLng();
                mpl.isSelect = true;
                mpl.setAngle(angleArray[i]);
                Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
                mMarker.setTag(mpl);
                mMarker.setFlat(true);
                this.arrowMarkerList.add(mMarker);
            }
        }
        j++;
    }
}
 
Example 5
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void setAiLineMarkByHistory(List<MapPointLatLng> points, List<MapPointLatLng> interests) {
    int i = 0;
    for (MapPointLatLng mpl : interests) {
        i++;
        mpl.nPos = i;
        Marker interestMarker = addInterestMarkerByHistory(mpl);
        interestMarker.setTag(mpl);
        interestMarker.setDraggable(true);
        this.interestMarkerList.add(interestMarker);
    }
    for (MapPointLatLng point : points) {
        Marker mMarker = addPointMarkerByHistory(point);
        if (point.mInrertestPoint != null) {
            findInterestPoint(point, (List) interests);
        }
        mMarker.setTag(point);
        this.mMarkerList.add(mMarker);
        point.distance = 0.0f;
        this.mMapPointList.add(point);
    }
    if (points.size() > 0) {
        drawPointLine(this.gglMapLocationManager.getDevLocation());
    }
}
 
Example 6
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void resetSmallMakerByMap(Marker marker1, Marker marker2, int n) {
    MapPointLatLng mpl1 = (MapPointLatLng) marker1.getTag();
    MapPointLatLng mpl2 = (MapPointLatLng) marker2.getTag();
    LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(marker1.getPosition(), marker2.getPosition(), 3);
    mpl2.setAngle(getPointAngle(mpl1, mpl2));
    float[] angleArray = new float[]{mpl2.showAngle, mpl2.showAngle};
    for (int i = 0; i < latLng.length; i++) {
        MapPointLatLng mpl = new MapPointLatLng();
        mpl.isSelect = true;
        mpl.setAngle(angleArray[i]);
        Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
        mMarker.setTag(mpl);
        mMarker.setFlat(true);
        this.arrowMarkerList.add(n + i, mMarker);
    }
}
 
Example 7
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addInreterstMarker(int x, int y) {
    boolean z = true;
    LatLng latLng = this.googleMap.getProjection().fromScreenLocation(new Point(x, y));
    MapPointLatLng mp = new MapPointLatLng();
    mp.isIntertestPoint = true;
    mp.isMapPoint = true;
    mp.nPos = this.interestMarkerList.size() + 1;
    int h = Math.round(StateManager.getInstance().getX8Drone().getHeight());
    if (h <= 5) {
        h = 5;
    }
    mp.altitude = (float) h;
    mp.latitude = latLng.latitude;
    mp.longitude = latLng.longitude;
    Marker interestMarker = addInterestMarker(latLng, (float) h, mp);
    interestMarker.setTag(mp);
    interestMarker.setDraggable(false);
    this.interestMarkerList.add(interestMarker);
    if (this.lineMarkerSelectListener != null) {
        IX8MarkerListener iX8MarkerListener = this.lineMarkerSelectListener;
        if (this.interestMarkerList.size() >= 20) {
            z = false;
        }
        iX8MarkerListener.onInterestSizeEnable(z);
    }
    this.isClick = false;
    onMarkerClick(interestMarker);
}
 
Example 8
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addInterestByDevice(AckGetAiLinePoint point) {
    MapPointLatLng mp = new MapPointLatLng();
    mp.isIntertestPoint = true;
    mp.isMapPoint = true;
    mp.nPos = this.interestMarkerList.size() + 1;
    mp.altitude = (float) point.getAltitudePOI();
    mp.latitude = point.getLatitudePOI();
    mp.longitude = point.getLongitudePOI();
    Marker interestMarker = addInterestMarker(new LatLng(mp.latitude, mp.longitude), mp.altitude, mp);
    interestMarker.setTag(mp);
    interestMarker.setDraggable(true);
    this.interestMarkerList.add(interestMarker);
}
 
Example 9
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addSmallMakerByMap(Marker marker1, Marker marker2) {
    MapPointLatLng mpl2 = (MapPointLatLng) marker2.getTag();
    LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(marker1.getPosition(), marker2.getPosition(), 3);
    float[] angleArray = new float[]{mpl2.showAngle, mpl2.showAngle};
    for (int i = 0; i < latLng.length; i++) {
        MapPointLatLng mpl = new MapPointLatLng();
        mpl.isSelect = true;
        mpl.setAngle(angleArray[i]);
        Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
        mMarker.setTag(mpl);
        mMarker.setFlat(true);
        this.arrowMarkerList.add(mMarker);
    }
}
 
Example 10
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addSmallMarkerByInterest() {
    clearAllSmallMarker();
    int j = 0;
    for (Marker marker : this.mMarkerList) {
        if (j > 0) {
            MapPointLatLng mpl1 = (MapPointLatLng) ((Marker) this.mMarkerList.get(j - 1)).getTag();
            MapPointLatLng mpl2 = (MapPointLatLng) ((Marker) this.mMarkerList.get(j)).getTag();
            if (mpl2.mInrertestPoint != null) {
                LatLng[] latLng = this.mapCalcAngle.getLineLatLngInterval(((Marker) this.mMarkerList.get(j - 1)).getPosition(), ((Marker) this.mMarkerList.get(j)).getPosition(), 3);
                float[] angleArray = new float[2];
                if (mpl1.mInrertestPoint == null) {
                    angleArray[0] = mpl2.showAngle;
                    angleArray[1] = mpl2.showAngle;
                } else {
                    angleArray = this.mapCalcAngle.getAnlgesByRoration(mpl1.showAngle, mpl2.showAngle, 0);
                }
                for (int i = 0; i < latLng.length; i++) {
                    MapPointLatLng mpl = new MapPointLatLng();
                    mpl.isSelect = true;
                    mpl.setAngle(angleArray[i]);
                    Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng[i]).icon(this.gdCustemMarkerView.createPointWithSmallArrow(this.context, R.drawable.x8_ai_line_point_small1, mpl.showAngle, true)).anchor(0.5f, 0.5f).draggable(false));
                    mMarker.setTag(mpl);
                    mMarker.setFlat(true);
                    this.arrowMarkerList.add(mMarker);
                }
            }
        }
        j++;
    }
}
 
Example 11
Source File: GoogleMapsMapAdapter.java    From ground-android with Apache License 2.0 5 votes vote down vote up
private void addMapPin(MapPin mapPin) {
  LatLng position = toLatLng(mapPin.getPosition());
  String color = mapPin.getStyle().getColor();
  BitmapDescriptor icon = markerIconFactory.getMarkerIcon(parseColor(color));
  Marker marker = map.addMarker(new MarkerOptions().position(position).icon(icon).alpha(1.0f));
  marker.setTag(mapPin);
  markers.add(marker);
}
 
Example 12
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void setAiLineMarkByDevice(List<AckGetAiLinePoint> points, List<AckGetAiLinePoint> interestPoints) {
    for (AckGetAiLinePoint point : interestPoints) {
        addInterestByDevice(point);
    }
    for (AckGetAiLinePoint point2 : points) {
        int res;
        BitmapDescriptor mBitmapDescriptor;
        MapPointLatLng mp = new MapPointLatLng();
        mp.yawMode = point2.getYawMode();
        int index = findInterestPoint(point2, (List) interestPoints);
        if (index != -1) {
            mp.mInrertestPoint = (MapPointLatLng) ((Marker) this.interestMarkerList.get(index)).getTag();
        }
        mp.altitude = (float) point2.getAltitude();
        mp.nPos = this.mMarkerList.size() + 1;
        FLatLng fLatLng = GpsCorrect.Earth_To_Mars(point2.getLatitude(), point2.getLongitude());
        LatLng latLng = new LatLng(fLatLng.latitude, fLatLng.longitude);
        mp.longitude = latLng.longitude;
        mp.latitude = latLng.latitude;
        mp.setAngle(point2.getAngle());
        if (point2.getYawMode() == (byte) 0) {
            res = R.drawable.x8_ai_line_point_no_angle2;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        if (mp.mInrertestPoint != null) {
            mBitmapDescriptor = this.gdCustemMarkerView.createMapPointWithPioView(this.context, res, mp.altitude, mp.nPos, mp.mInrertestPoint.nPos, mp.showAngle, mp.isSelect, false);
        } else {
            mBitmapDescriptor = this.gdCustemMarkerView.createMapPointAngleNoPioView(this.context, res, mp.altitude, mp.nPos, mp.showAngle, mp.isSelect, false);
        }
        Marker mMarker = this.googleMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.64285713f).draggable(false));
        mMarker.setTag(mp);
        mMarker.setFlat(true);
        this.mMarkerList.add(mMarker);
        mp.distance = 0.0f;
        this.mMapPointList.add(mp);
    }
    if (points.size() > 0) {
        drawPointLine(this.gglMapLocationManager.getDevLocation());
    }
}
 
Example 13
Source File: CampusMapActivity.java    From utexas-utilities with Apache License 2.0 4 votes vote down vote up
/**
 * Displays a route as a set of stop markers and polylines
 *
 * @param routeid - the route id to load
 */
private void loadRoute(String routeid) {
    if (!checkReady()) {
        return;
    }
    this.routeid = routeid;
    if (NO_ROUTE_ID.equals(routeid)) {
        // remove any currently showing routes and return
        clearAllMapRoutes();
        shownStops.clear();
        return;
    }
    AnalyticsHandler.trackBusRouteEvent();
    try {
        initRouteData();
        String tracePath = "traces/" + traces_al.get(traces_al.indexOf(routeid + ".txt"));
        String trace = loadAssetAsString(tracePath);
        Deque<LatLng> navData = new ArrayDeque<>();
        for (String latlng : trace.split(";")) {
            navData.add(new LatLng(Double.parseDouble(latlng.split(",")[0]),
                                   Double.parseDouble(latlng.split(",")[1])));
        }

        drawPath(navData, BURNT_ORANGE);

        String stopPath = "stops/" + stops_al.get(stops_al.indexOf(routeid + "_stops.txt"));
        String stopData = loadAssetAsString(stopPath);
        String[] stops = stopData.split("\n");

        // clear the stops from the old route
        shownStops.clear();

        for (String stop : stops) {
            String data[] = stop.split("\t");
            Double lat = Double.parseDouble(data[0].split(",")[0].trim());
            Double lng = Double.parseDouble(data[0].split(",")[1].trim());
            String title = data[1];
            int stopid = Integer.parseInt(data[2].trim());

            Marker marker = shownStops.addMarker(new MarkerOptions()
                    .position(new LatLng(lat, lng))
                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_bus))
                    .title(title)
                    .snippet(STOP_TIME_PLACEHOLDER));
            marker.setTag(new BusStop(stopid));
        }

    } catch (IOException e) {
        e.printStackTrace();
        Log.d("DirectionMap",
                "Exception loading some file related to the kml or the stops files.");
    }
}