Exemple #1
0
        public override GOFeature ParseFeatureData(VectorTileFeature feature, GOLayer layer)
        {
            IDictionary properties = feature.GetProperties();
            GOFeature   goFeature;

            if (layer.layerType == GOLayer.GOLayerType.Roads)
            {
                goFeature = new GORoadFeature();
            }
            else
            {
                goFeature = new GOFeature();
            }

            goFeature.kind = GOEnumUtils.MapboxToKind(layer.name);

            goFeature.y = layer.defaultLayerY();
            if (properties.Contains("_symbol"))
            {
                goFeature.y = Convert.ToInt64(properties ["_symbol"]) / 10.0f * Global.tilesizeRank;
            }

            goFeature.height = layer.defaultRendering.polygonHeight;

            return(goFeature);
        }
        public override GOFeature ParseFeatureData(VectorTileFeature feature, GOLayer layer)
        {
            IDictionary properties = feature.GetProperties();
            GOFeature   goFeature;

            if (layer.layerType == GOLayer.GOLayerType.Roads)
            {
                goFeature = new GORoadFeature();
                ((GORoadFeature)goFeature).isBridge = properties.Contains("brunnel") && (string)properties ["brunnel"] == "bridge";
                ((GORoadFeature)goFeature).isTunnel = properties.Contains("brunnel") && (string)properties ["brunnel"] == "tunnel";
                ((GORoadFeature)goFeature).isLink   = properties.Contains("brunnel") && (string)properties ["brunnel"] == "link";
            }
            else
            {
                goFeature = new GOFeature();
            }

            goFeature.kind = GOEnumUtils.MapboxToKind((string)properties["class"]);

            goFeature.y = goFeature.index / 1000 + layer.defaultLayerY();

            if (goFeature.kind == GOFeatureKind.lake)             //terrible fix for vector maps without a sort value.
            {
                goFeature.y = layer.defaultLayerY(GOLayer.GOLayerType.Landuse);
            }

            goFeature.height = layer.defaultRendering.polygonHeight;

            if (layer.useRealHeight && properties.Contains("render_height"))
            {
                double h = Convert.ToDouble(properties["render_height"]);
                goFeature.height = (float)h;
            }

            if (layer.useRealHeight && properties.Contains("render_min_height"))
            {
                double hm = Convert.ToDouble(properties["render_min_height"]);
                goFeature.y = (float)hm;
                if (goFeature.height >= hm)
                {
                    goFeature.y      = (float)hm;
                    goFeature.height = (float)goFeature.height - (float)hm;
                }
            }

            return(goFeature);
        }