Exemple #1
0
        public EditProjectGeospatialAreasViewDataForAngular(MapInitJson mapInitJson,
                                                            List <ProjectFirmaModels.Models.GeospatialArea> geospatialAreasInViewModel, GeospatialAreaType geospatialAreaType,
                                                            List <ProjectFirmaModels.Models.fGeoServerGeospatialAreaAreasContainingProjectLocation_Result> geospatialAreasContainingProjectSimpleLocation, bool hasProjectLocationPoint)
        {
            MapInitJson = mapInitJson;
            FindGeospatialAreaByNameUrl =
                SitkaRoute <ProjectGeospatialAreaController> .BuildUrlFromExpression(c =>
                                                                                     c.FindGeospatialAreaByName(geospatialAreaType, null));

            TypeAheadInputId = "geospatialAreaSearch";

            GeospatialAreaMapServiceLayerName = geospatialAreaType.GeospatialAreaLayerName;
            MapServiceUrl                    = geospatialAreaType.MapServiceUrl();
            GeospatialAreaTypeName           = geospatialAreaType.GeospatialAreaTypeName;
            GeospatialAreaTypeNamePluralized = geospatialAreaType.GeospatialAreaTypeNamePluralized;

            GeospatialAreaNameByID =
                geospatialAreasInViewModel.ToDictionary(x => x.GeospatialAreaID, x => x.GeospatialAreaShortName);

            GeospatialAreaNameByID.AddAll(
                geospatialAreasContainingProjectSimpleLocation
                .Where(x => !GeospatialAreaNameByID.ContainsKey(x.GeospatialAreaID)).ToDictionary(
                    x => x.GeospatialAreaID,
                    x => x.GeospatialAreaShortName));

            GeospatialAreaIDsContainingProjectSimpleLocation = geospatialAreasContainingProjectSimpleLocation
                                                               .Select(x => x.GeospatialAreaID).ToList();

            HasProjectLocationPoint = hasProjectLocationPoint;
        }
 public GeospatialAreaTypeSimple(GeospatialAreaType geospatialAreaType)
 {
     GeospatialAreaTypeID             = geospatialAreaType.GeospatialAreaTypeID;
     GeospatialAreaTypeName           = geospatialAreaType.GeospatialAreaTypeName;
     GeospatialAreaTypeNamePluralized = geospatialAreaType.GeospatialAreaTypeNamePluralized;
     GeospatialAreaTypeLayerName      = geospatialAreaType.GeospatialAreaLayerName;
     GeospatialAreaTypeMapServiceUrl  = geospatialAreaType.MapServiceUrl();
 }
 // This is called for editor maps where layer initial visibility may be different from what's configured on the GeospatialAreaType
 public static LayerGeoJson GetGeospatialAreaWmsLayerGeoJson(this GeospatialAreaType geospatialAreaType,
                                                             string layerColor, decimal layerOpacity,
                                                             LayerInitialVisibility.LayerInitialVisibilityEnum layerInitialVisibility)
 {
     return(new LayerGeoJson(geospatialAreaType.GeospatialAreaTypeNamePluralized,
                             geospatialAreaType.MapServiceUrl(),
                             geospatialAreaType.GeospatialAreaLayerName, MapTooltipUrlTemplate.UrlTemplateString, layerColor,
                             layerOpacity,
                             layerInitialVisibility));
 }
Exemple #4
0
        public static HtmlString GetGeoJsonLinkHtmlString(this GeospatialAreaType geospatialAreaType)
        {
            var mapServiceUri = new UriBuilder(geospatialAreaType.MapServiceUrl());

            mapServiceUri.Path = mapServiceUri.Path.Replace("/wms", "/ows");

            NameValueCollection queryString = HttpUtility.ParseQueryString(string.Empty);

            queryString["service"]      = "WFS";
            queryString["version"]      = "1.0.0";
            queryString["request"]      = "GetFeature";
            queryString["typeName"]     = geospatialAreaType.GeospatialAreaLayerName;
            queryString["outputFormat"] = "application/json";
            queryString["maxFeatures"]  = "500";
            queryString["sortBy"]       = "PrimaryKey";
            queryString["startIndex"]   = "0";
            mapServiceUri.Query         = queryString.ToString();

            return(UrlTemplate.MakeHrefString(mapServiceUri.ToString(), mapServiceUri.ToString()));
        }