Java Code Examples for com.nextgis.maplib.util.Constants#NGW_v3

The following examples show how to use com.nextgis.maplib.util.Constants#NGW_v3 . 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: ResourceGroup.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void addResource(JSONObject data) {
    int type = getType(data);
    Resource resource = null;
    switch (type) {
        case Connection.NGWResourceTypeResourceGroup:
            resource = new ResourceGroup(data, mConnection);
            break;
        case Connection.NGWResourceTypePostgisLayer:
            if (mConnection.getNgwVersionMajor() < Constants.NGW_v3)
                break;
        case Connection.NGWResourceTypeVectorLayer:
        case Connection.NGWResourceTypeRasterLayer:
            LayerWithStyles layer = new LayerWithStyles(data, mConnection);
            layer.fillExtent();
            layer.fillStyles();
            resource = layer;
            break;
        case Connection.NGWResourceTypeWMSClient:
            resource = new LayerWithStyles(data, mConnection);
            break;
        case Connection.NGWResourceTypeLookupTable:
            resource = new ResourceWithoutChildren(data, mConnection);
            break;
        case Connection.NGWResourceTypeWebMap:
            resource = new WebMap(data, mConnection);
            break;
    }

    if (null != resource) {
        resource.setParent(this);
        resource.fillPermissions();
        mChildren.add(resource);
    }
}
 
Example 2
Source File: ResourceGroup.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ResourceGroup(Parcel in) {
    super(in);
    mChildrenLoaded = in.readByte() == 1;
    mChildren = new ArrayList<>();
    int count = in.readInt();

    for (int i = 0; i < count; i++) {
        int type = in.readInt();
        switch (type) {
            case Connection.NGWResourceTypeResourceGroup:
                ResourceGroup resourceGroup = in.readParcelable(ResourceGroup.class.getClassLoader());
                resourceGroup.setParent(this);
                mChildren.add(resourceGroup);
                break;
            case Connection.NGWResourceTypePostgisLayer:
                if (mConnection.getNgwVersionMajor() < Constants.NGW_v3)
                    break;
            case Connection.NGWResourceTypeRasterLayer:
            case Connection.NGWResourceTypeVectorLayer:
            case Connection.NGWResourceTypeWMSClient:
                LayerWithStyles layer = in.readParcelable(LayerWithStyles.class.getClassLoader());
                layer.setParent(this);
                mChildren.add(layer);
                break;
            case Connection.NGWResourceTypeLookupTable:
                ResourceWithoutChildren resourceWoChildren = in.readParcelable(ResourceWithoutChildren.class.getClassLoader());
                resourceWoChildren.setParent(this);
                mChildren.add(resourceWoChildren);
            case Connection.NGWResourceTypeWebMap:
                WebMap webMap = in.readParcelable(WebMap.class.getClassLoader());
                webMap.setParent(this);
                mChildren.add(webMap);
                break;
        }
    }
}
 
Example 3
Source File: NGWVectorLayer.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void create(
        int geometryType,
        List<Field> fields)
        throws SQLiteException
{
    if (mNgwVersionMajor < Constants.NGW_v3 && geometryType < 4
            && mNGWLayerType == Connection.NGWResourceTypeVectorLayer) {
        // to multi
        geometryType += 3;
    }

    super.create(geometryType, fields);
    FeatureChanges.initialize(getChangeTableName());
}
 
Example 4
Source File: NGWVectorLayer.java    From android_maplib with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected boolean checkGeometryType(Feature feature)
{
    return mNgwVersionMajor < Constants.NGW_v3 || super.checkGeometryType(feature);
}