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

The following examples show how to use com.google.android.gms.maps.model.Marker#getTag() . 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: GoogleMapsMapAdapter.java    From ground-android with Apache License 2.0 6 votes vote down vote up
@Override
public void setMapPins(ImmutableSet<MapPin> updatedPins) {
  if (updatedPins.isEmpty()) {
    removeAllMarkers();
    return;
  }
  Set<MapPin> pinsToAdd = new HashSet<>(updatedPins);
  Iterator<Marker> it = markers.iterator();
  while (it.hasNext()) {
    Marker marker = it.next();
    MapPin pin = (MapPin) marker.getTag();
    if (updatedPins.contains(pin)) {
      // If pin already exists on map, don't add it.
      pinsToAdd.remove(pin);
    } else {
      // Remove existing pins not in list of updatedPins.
      removeMarker(marker);
      it.remove();
    }
  }
  stream(pinsToAdd).forEach(this::addMapPin);
}
 
Example 2
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void lightPoint(MapPointLatLng mpl, boolean isRelation) {
    if (!mpl.isMapPoint) {
        return;
    }
    MapPointLatLng tmp;
    if (mpl.isIntertestPoint) {
        for (Marker marker : this.mMarkerList) {
            tmp = (MapPointLatLng) marker.getTag();
            if (tmp.mInrertestPoint == mpl) {
                changePointMarker(marker, tmp, isRelation);
            }
        }
    } else if (mpl.mInrertestPoint != null) {
        for (Marker interest : this.interestMarkerList) {
            tmp = (MapPointLatLng) interest.getTag();
            if (mpl.mInrertestPoint == tmp) {
                changePointMarker(interest, tmp, isRelation);
                return;
            }
        }
    }
}
 
Example 3
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 4
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onMarkerDragEnd(Marker marker) {
    MapPointLatLng mp = (MapPointLatLng) marker.getTag();
    marker.setIcon(this.gdCustemMarkerView.createMapPioView(this.context, R.drawable.x8_img_ai_line_inreterst_max1, mp.altitude, mp.nPos, false, false));
    MapPointLatLng tmp = (MapPointLatLng) marker.getTag();
    tmp.isInrertestPointActive = true;
    tmp.latitude = marker.getPosition().latitude;
    tmp.longitude = marker.getPosition().longitude;
    int i = 0;
    for (MapPointLatLng mpl : this.mMapPointList) {
        if (mpl.mInrertestPoint != null && tmp == mpl.mInrertestPoint) {
            mpl.setAngle(getPointAngle(mpl, tmp));
            changePointMarker((Marker) this.mMarkerList.get(i), mpl, false);
        }
        i++;
    }
}
 
Example 5
Source File: CampusMapActivity.java    From utexas-utilities with Apache License 2.0 6 votes vote down vote up
@Override
public View getInfoContents(Marker marker) {
    BusStop stopInfo = (BusStop) marker.getTag();
    if (stopInfo.refreshing ||
            (stopInfo.fetchTimesTask != null &&
                    stopInfo.fetchTimesTask.getStatus() == AsyncTask.Status.FINISHED &&
                    !stopInfo.fetchTimesTask.failed)) {
        View view = super.getInfoContents(marker);
        infoSnippet.setText(stopInfo.times);
        return view;
    } else if (stopInfo.fetchTimesTask == null || stopInfo.fetchTimesTask.failed) {
        int stopid = stopInfo.stopid;
        stopInfo.fetchTimesTask = new CheckStopTask(infoSnippet);
        stopInfo.fetchTimesTask.execute(stopid, marker);
    }
    return super.getInfoContents(marker);
}
 
Example 6
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 7
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 8
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void clearAllSmallMarker() {
    for (Marker marker : this.arrowMarkerList) {
        marker.remove();
    }
    this.arrowMarkerList.clear();
    int i = 0;
    for (Marker marker2 : this.mMarkerList) {
        MapPointLatLng p = (MapPointLatLng) marker2.getTag();
        p.isSelect = false;
        if (this.mSelectMarker != null && ((MapPointLatLng) this.mSelectMarker.getTag()) == p) {
            p.isSelect = true;
        }
        changeViewBySetPoints(marker2, p, false, false);
        i++;
    }
}
 
Example 9
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void deleteSmallMaker(Marker deleteMarker) {
    if (this.arrowMarkerList.size() > 0) {
        int index = ((MapPointLatLng) deleteMarker.getTag()).nPos - 1;
        if (index != 0) {
            int n = (index - 1) * 2;
            Marker m1 = (Marker) this.arrowMarkerList.get(n);
            m1.remove();
            Marker m2 = (Marker) this.arrowMarkerList.get(n + 1);
            m2.remove();
            this.arrowMarkerList.remove(m1);
            this.arrowMarkerList.remove(m2);
        }
    }
}
 
Example 10
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addSmallMakerByHistory() {
    int i = 0;
    for (Marker marker : this.mMarkerList) {
        MapPointLatLng p = (MapPointLatLng) marker.getTag();
        if (i != 0) {
            addSmallMakerByMap((Marker) this.mMarkerList.get(i - 1), (Marker) this.mMarkerList.get(i));
        }
        i++;
    }
}
 
Example 11
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void removeInterestPoint() {
    MapPointLatLng tmp = (MapPointLatLng) this.mSelectMarker.getTag();
    int i = 0;
    for (MapPointLatLng mpl : this.mMapPointList) {
        if (mpl.mInrertestPoint != null && tmp == mpl.mInrertestPoint) {
            mpl.mInrertestPoint = null;
            changePointMarker((Marker) this.mMarkerList.get(i), mpl, false);
        }
        i++;
    }
    this.interestMarkerList.remove(this.mSelectMarker);
    this.mSelectMarker.remove();
    i = 0;
    for (Marker marker : this.interestMarkerList) {
        i++;
        MapPointLatLng p = (MapPointLatLng) marker.getTag();
        p.nPos = i;
        changePointMarker(marker, p, false);
    }
    this.mSelectMarker = null;
    if (this.lineMarkerSelectListener != null) {
        boolean z;
        IX8MarkerListener iX8MarkerListener = this.lineMarkerSelectListener;
        if (this.interestMarkerList.size() < 20) {
            z = true;
        } else {
            z = false;
        }
        iX8MarkerListener.onInterestSizeEnable(z);
    }
}
 
Example 12
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void removeLinePoint(LatLng homeLocation) {
    MapPointLatLng removeMapPointLatLng = null;
    for (MapPointLatLng mMapPointLatLng : this.mMapPointList) {
        LatLng mLatLng = this.mSelectMarker.getPosition();
        if (mLatLng.longitude == mMapPointLatLng.longitude && mLatLng.latitude == mMapPointLatLng.latitude) {
            removeMapPointLatLng = mMapPointLatLng;
            break;
        }
    }
    if (removeMapPointLatLng != null) {
        this.mMapPointList.remove(removeMapPointLatLng);
    }
    for (Marker marker : this.mMarkerList) {
        if (this.mSelectMarker == marker) {
            break;
        }
    }
    this.mMarkerList.remove(this.mSelectMarker);
    this.mSelectMarker.remove();
    int i = 0;
    for (Marker marker2 : this.mMarkerList) {
        i++;
        MapPointLatLng p = (MapPointLatLng) marker2.getTag();
        p.nPos = i;
        changePointMarker(marker2, p, false);
    }
    drawPointLine(homeLocation);
    this.mSelectMarker = null;
    this.lineMarkerSelectListener.onMarkerSizeChange(this.mMarkerList.size());
}
 
Example 13
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 14
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addSmallMarkerByMap(int type) {
    if (type == 0) {
        int i = 0;
        clearAllInterestMarker();
        for (Marker marker : this.mMarkerList) {
            MapPointLatLng p = (MapPointLatLng) marker.getTag();
            clearAllInterestMarkerByMap(p);
            changeViewBySetPoints(marker, p, false, false);
            if (i != 0) {
                addSmallMakerByMap((Marker) this.mMarkerList.get(i - 1), (Marker) this.mMarkerList.get(i));
            }
            i++;
        }
    }
}
 
Example 15
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void removeInterestUnBebind() {
    MapPointLatLng p;
    boolean z = false;
    Marker tmp = null;
    for (Marker m : this.interestMarkerList) {
        MapPointLatLng mpl = (MapPointLatLng) m.getTag();
        boolean isFind = false;
        for (MapPointLatLng p2 : this.mMapPointList) {
            if (p2.mInrertestPoint != null && p2.mInrertestPoint == mpl) {
                isFind = true;
                continue;
                break;
            }
        }
        if (!isFind) {
            tmp = m;
            break;
        }
    }
    if (tmp != null) {
        this.interestMarkerList.remove(tmp);
        tmp.remove();
        int i = 0;
        for (Marker marker : this.interestMarkerList) {
            i++;
            p2 = (MapPointLatLng) marker.getTag();
            p2.nPos = i;
            changePointMarker(marker, p2, false);
        }
    }
    if (this.lineMarkerSelectListener != null) {
        IX8MarkerListener iX8MarkerListener = this.lineMarkerSelectListener;
        if (this.interestMarkerList.size() < 20) {
            z = true;
        }
        iX8MarkerListener.onInterestSizeEnable(z);
    }
}
 
Example 16
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void lightInterestPointByRunning(MapPointLatLng mpl, boolean isLight) {
    if (mpl.isMapPoint && mpl.mInrertestPoint != null) {
        for (Marker interest : this.interestMarkerList) {
            MapPointLatLng tmp = (MapPointLatLng) interest.getTag();
            if (mpl.mInrertestPoint == tmp) {
                tmp.isSelect = isLight;
                changePointMarker(interest, tmp, false);
                return;
            }
        }
    }
}
 
Example 17
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public boolean onMarkerClick(Marker marker) {
    if (isOnMarkerClickValid()) {
        MapPointLatLng mp = (MapPointLatLng) marker.getTag();
        if (mp != null) {
            if (this.mSelectMarker == null) {
                this.mSelectMarker = marker;
                mp.isSelect = true;
                changePointMarker(this.mSelectMarker, mp, false);
                lightPoint(mp, true);
            } else if (this.mSelectMarker.getTag() == marker.getTag()) {
                mp.isSelect = false;
                this.mSelectMarker = null;
                changePointMarker(marker, mp, false);
                lightPoint(mp, false);
            } else {
                Marker lastMarker = this.mSelectMarker;
                MapPointLatLng lastMp = (MapPointLatLng) lastMarker.getTag();
                lastMp.isSelect = false;
                changePointMarker(lastMarker, lastMp, false);
                lightPoint(lastMp, false);
                this.mSelectMarker = marker;
                mp.isSelect = true;
                changePointMarker(this.mSelectMarker, mp, false);
                lightPoint(mp, true);
            }
            this.lineMarkerSelectListener.onMarkerSelect(mp.isSelect, mp.altitude, mp, this.isClick);
            this.isClick = true;
        }
    }
    return true;
}
 
Example 18
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void notityChangeView(MapPointLatLng des) {
    for (Marker marker : this.mMarkerList) {
        if (des == ((MapPointLatLng) marker.getTag())) {
            changePointMarker(marker, des, false);
            lightPoint(des, true);
            return;
        }
    }
}
 
Example 19
Source File: DriverMapPresenter.java    From ridesharing-android with MIT License 5 votes vote down vote up
@Override
protected boolean onMarkerClick(Marker marker) {
    if (marker.getTag() instanceof String) {
        String tag = (String) marker.getTag();
        if (mState.newOrders.containsKey(tag)) {
            selectOrder(tag);
            return true;
        }
    }
    return false;
}
 
Example 20
Source File: GglMapAiLineManager.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onMarkerDragStart(Marker marker) {
    MapPointLatLng mp = (MapPointLatLng) marker.getTag();
    marker.setIcon(this.gdCustemMarkerView.createMapPioView(this.context, R.drawable.x8_img_ai_line_inreterst_max2, mp.altitude, mp.nPos, true, false));
}