Java Code Examples for com.nextgis.maplib.datasource.GeoMultiLineString#size()

The following examples show how to use com.nextgis.maplib.datasource.GeoMultiLineString#size() . 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: SimpleLineStyle.java    From android_maplib with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onDraw(GeoGeometry geoGeometry, GISDisplay display) {
    mColor = Color.argb(mInnerAlpha, Color.red(mColor), Color.green(mColor), Color.blue(mColor));
    mOutColor = Color.argb(mOuterAlpha, Color.red(mOutColor), Color.green(mOutColor), Color.blue(mOutColor));

    switch (geoGeometry.getType()) {
        case GTLineString:
            onDraw((GeoLineString) geoGeometry, display);
            break;

        case GTMultiLineString:
            GeoMultiLineString multiLineString = (GeoMultiLineString) geoGeometry;
            for (int i = 0; i < multiLineString.size(); i++) {
                onDraw(multiLineString.get(i), display);
            }
            break;

        //throw new IllegalArgumentException(
        //        "The input geometry type is not support by this style");
    }

}
 
Example 2
Source File: SimpleTiledPolygonStyle.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onDraw(GeoGeometry geoGeometry, GISDisplay display) {
    switch (geoGeometry.getType()) {
        case GTPolygon:
            drawPolygon((GeoPolygon) geoGeometry, display);
            break;
        case GTMultiPolygon:
            GeoMultiPolygon multiPolygon = (GeoMultiPolygon) geoGeometry;

            for (int i = 0; i < multiPolygon.size(); i++) {
                drawPolygon(multiPolygon.get(i), display);
            }
            break;
        case GTPoint:
            drawPoint((GeoPoint) geoGeometry, display);
            break;
        case GTMultiPoint:
            GeoMultiPoint multiPoint = (GeoMultiPoint) geoGeometry;
            for (int i = 0; i < multiPoint.size(); i++) {
                drawPoint(multiPoint.get(i), display);
            }
            break;
        case GTLineString:
            drawLineString((GeoLineString) geoGeometry, display);
            break;
        case GTMultiLineString:
            GeoMultiLineString multiLineString = (GeoMultiLineString) geoGeometry;
            for (int i = 0; i < multiLineString.size(); i++) {
                drawLineString(multiLineString.get(i), display);
            }
            break;
    }
}
 
Example 3
Source File: EditLayerOverlay.java    From android_maplibui with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void fillDrawItems(GeoGeometry geom) {
    int lastItemsCount = mDrawItems.size();
    int lastSelectedItemPosition = mDrawItems.indexOf(mSelectedItem);
    DrawItem lastSelectedItem = mSelectedItem;
    mDrawItems.clear();

    if (null == geom) {
        Log.w(Constants.TAG, "the geometry is null in fillDrawItems method");
        return;
    }

    GeoPoint[] geoPoints = new GeoPoint[1];
    Location last = mGpsEventSource.getLastKnownLocation();
    switch (geom.getType()) {
        case GeoConstants.GTPoint:
            geoPoints[0] = (GeoPoint) geom;
            mSelectedItem = new DrawItem(DrawItem.TYPE_VERTEX, mapToScreen(geoPoints));
            mDrawItems.add(mSelectedItem);
            break;
        case GeoConstants.GTMultiPoint:
            GeoMultiPoint geoMultiPoint = (GeoMultiPoint) geom;
            for (int i = 0; i < geoMultiPoint.size(); i++) {
                geoPoints[0] = geoMultiPoint.get(i);
                mSelectedItem = new DrawItem(DrawItem.TYPE_VERTEX, mapToScreen(geoPoints));
                mDrawItems.add(mSelectedItem);
            }
            break;
        case GeoConstants.GTLineString:
            fillDrawLine((GeoLineString) geom);
            break;
        case GeoConstants.GTMultiLineString:
            GeoMultiLineString multiLineString = (GeoMultiLineString) geom;
            for (int i = 0; i < multiLineString.size(); i++)
                fillDrawLine(multiLineString.get(i));
            break;
        case GeoConstants.GTPolygon:
            fillDrawPolygon((GeoPolygon) geom);
            break;
        case GeoConstants.GTMultiPolygon:
            GeoMultiPolygon multiPolygon = (GeoMultiPolygon) geom;
            for (int i = 0; i < multiPolygon.size(); i++)
                fillDrawPolygon(multiPolygon.get(i));
            break;
        case GeoConstants.GTGeometryCollection:
            GeoGeometryCollection collection = (GeoGeometryCollection) geom;
            for (int i = 0; i < collection.size(); i++) {
                GeoGeometry geoGeometry = collection.get(i);
                fillDrawItems(geoGeometry);
            }
            break;
        default:
            break;
    }

    if (mDrawItems.size() == lastItemsCount && lastSelectedItem != null &&
            lastSelectedItemPosition != Constants.NOT_FOUND) {
        mSelectedItem = mDrawItems.get(lastSelectedItemPosition);
        mSelectedItem.setSelectedRing(lastSelectedItem.getSelectedRingId());
        mSelectedItem.setSelectedPoint(lastSelectedItem.getSelectedPointId());
    } else {
        mSelectedItem = mDrawItems.get(0);
    }

    switch (geom.getType()) {
        case GeoConstants.GTPoint:
        case GeoConstants.GTMultiPoint:
            updateDistance(last, null);
            break;
    }
}