Legend Legend()
 {
     return(new Legend()
     {
         Title = Title, Fill = PathStyle.Find <Brush>(Path.FillProperty), Stroke = PathStyle.Find <Brush>(Path.StrokeProperty)
     });
 }
Пример #2
0
 public WindowsPathResolver()
 {
     m_options = new Mono.Options.OptionSet();
     m_options.Add("v|verbose", "Verbose mode", v => { m_verbose = true; });
     m_options.Add("f|file", "Want file resolution", v => { m_resolution = Resolution.File; });
     m_options.Add("d|directory", "Want directory resolution", v => { m_resolution = Resolution.Directory; });
     m_options.Add("cmake", "CMake style path", v => { m_path_style = PathStyle.CMake; });
     m_options.Add("h|help", "Show help page", v => { m_show_help = true; });
 }
Пример #3
0
    public override void BindToParkitect(GameObject hider, AssetBundle bundle)
    {
        BaseDecorator        baseDecorator     = DecoratorByInstance <BaseDecorator>();
        CategoryDecorator    categoryDecorator = DecoratorByInstance <CategoryDecorator>();
        BoundingBoxDecorator boxDecorator      = DecoratorByInstance <BoundingBoxDecorator>();

        PathStyle c  = AssetManager.Instance.pathStyles.getPathStyle("concrete");
        PathStyle ps = new PathStyle();

        ps.handRailGO     = c.handRailGO;
        ps.handRailRampGO = c.handRailRampGO;
        Material mat = Instantiate(c.material);

        mat.mainTexture          = bundle.LoadAsset <Texture>(PathTexturePath);
        ps.material              = mat;
        ps.platformTileMapper    = AssetManager.Instance.platformTileMapper;
        ps.identifier            = Key;
        ps.spawnSound            = c.spawnSound;
        ps.despawnSoundEvent     = c.despawnSoundEvent;
        ps.spawnLastSound        = c.spawnLastSound;
        ps.spawnTilesOnPlatforms = true;

        _pathStyle = ps;

        switch (PathType)
        {
        case PathType.Normal:
            AssetManager.Instance.pathStyles.registerPathStyle(ps);
            break;

        case PathType.Queue:
            AssetManager.Instance.queueStyles.registerPathStyle(ps);
            break;

        case PathType.Employee:
            AssetManager.Instance.employeePathStyles.registerPathStyle(ps);
            break;
        }
    }
Пример #4
0
        public void InitSettings()
        {
            try {
                switch (myOptions["PathStyle"])
                {
                case "None":
                    pathStyle = PathStyle.None;
                    break;

                case "Relative":
                    pathStyle = PathStyle.Relative;
                    break;

                case "Full":
                    pathStyle = PathStyle.Full;
                    break;

                default:
                    pathStyle = PathStyle.Relative;
                    break;
                }

                deflateFiles      = bool.Parse(myOptions["DeflateFiles"]);
                includeSubFolders = bool.Parse(myOptions["RecursiveSubDirectories"]);

                compressionLevel = int.Parse(myOptions["CompressionLevel"]);
                outputNameType   = int.Parse(myOptions["OutputNameType"]);

                zipComment  = myOptions["ZipComment"];
                zipPassword = myOptions["ZipPassword"];
                outputDir   = myOptions["OutputDir"];
                outputName  = myOptions["OutputName"];
            }
            catch (FormatException fe) {
                MessageBox.Show("Error parsing the configuration file.\n" + fe.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        Legend Legend()
        {
            var mk = MarkerTemplate?.LoadContent();

            if (mk is Geometry gx)
            {
                // need something because it's all in NDC
                gx.Transform = new ScaleTransform()
                {
                    ScaleX = 24, ScaleY = 24
                };
                return(new LegendWithGeometry()
                {
                    Data = gx, Title = Title, Fill = PathStyle.Find <Brush>(Path.FillProperty), Stroke = PathStyle.Find <Brush>(Path.StrokeProperty)
                });
            }
            else
            {
                return(new Legend()
                {
                    Title = Title, Fill = PathStyle.Find <Brush>(Path.FillProperty), Stroke = PathStyle.Find <Brush>(Path.StrokeProperty)
                });
            }
        }
Пример #6
0
        public string GenerateStaticMapURL(StaticMapRequest request)
        {
            string scheme = request.IsSSL ? "https://" : "http://";

            var parametersList = new QueryStringParametersList();

            if (!string.IsNullOrEmpty(request.ApiKey))
            {
                string apiKey = request.ApiKey;
                parametersList.Add("key", apiKey);
            }

            if (request.Center != null)
            {
                ILocationString center = request.Center;

                string centerLocation = center.LocationString;

                parametersList.Add("center", centerLocation);
            }

            if (request.Zoom != default(int))
            {
                parametersList.Add("zoom", request.Zoom.ToString());
            }

            if (request.Scale != default(int))
            {
                if (!ValidScales.Contains(request.Scale))
                {
                    throw new ArgumentException("Scale is invalid; must be a value of 1, 2 or 4");
                }

                parametersList.Add("scale", request.Scale.ToString());
            }

            if (request.Size.Width != default(int) || request.Size.Height != default(int))
            {
                ImageSize imageSize = request.Size;

                parametersList.Add("size", string.Format("{0}x{1}", imageSize.Width, imageSize.Height));
            }
            else
            {
                throw new ArgumentException("Size is invalid");
            }

            if (request.ImageFormat != default(ImageFormat))
            {
                string format;

                switch (request.ImageFormat)
                {
                case ImageFormat.PNG8:
                    format = "png8";
                    break;

                case ImageFormat.PNG32:
                    format = "png32";
                    break;

                case ImageFormat.GIF:
                    format = "gif";
                    break;

                case ImageFormat.JPG:
                    format = "jpg";
                    break;

                case ImageFormat.JPG_baseline:
                    format = "jpg-baseline";
                    break;

                default:
                    throw new ArgumentOutOfRangeException("ImageFormat");
                }

                parametersList.Add("format", format);
            }

            if (request.MapType != null)
            {
                string type;

                switch (request.MapType)
                {
                case MapType.Roadmap:
                    type = "roadmap";
                    break;

                case MapType.Satellite:
                    type = "satellite";
                    break;

                case MapType.Terrain:
                    type = "terrain";
                    break;

                case MapType.Hybrid:
                    type = "hybrid";
                    break;

                default:
                    throw new ArgumentOutOfRangeException("MapType");
                }

                parametersList.Add("maptype", type);
            }

            if (request.Style != null)
            {
                MapStyle style = request.Style;

                var styleComponents = new List <string>();

                if (style.MapFeature != default(MapFeature))
                {
                    string mapFeature;

                    switch (style.MapFeature)
                    {
                    case MapFeature.All:
                        mapFeature = "all";
                        break;

                    case MapFeature.Road:
                        mapFeature = "road";
                        break;

                    case MapFeature.Landscape:
                        mapFeature = "landscape";
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    styleComponents.Add("feature:" + mapFeature);
                }

                if (style.MapElement != default(MapElement))
                {
                    string element;

                    switch (style.MapElement)
                    {
                    case MapElement.All:
                        element = "all";
                        break;

                    case MapElement.Geometry:
                        element = "geometry";
                        break;

                    case MapElement.Labels:
                        element = "lables";
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    styleComponents.Add("element:" + element);
                }

                string hue = style.HUE;
                if (hue != null)
                {
                    styleComponents.Add("hue:" + hue);
                }

                float?lightness = style.Lightness;
                if (lightness != null)
                {
                    styleComponents.Add("lightness:" + lightness);
                }


                float?saturation = style.Saturation;
                if (saturation != null)
                {
                    styleComponents.Add("saturation:" + saturation);
                }

                float?gamma = style.Gamma;
                if (gamma != null)
                {
                    styleComponents.Add("gamma:" + gamma);
                }

                bool inverseLightness = style.InverseLightness;
                if (inverseLightness)
                {
                    styleComponents.Add("inverse_lightnes:true");
                }

                MapVisibility mapVisibility = style.MapVisibility;

                if (mapVisibility != default(MapVisibility))
                {
                    string visibility;

                    switch (mapVisibility)
                    {
                    case MapVisibility.On:
                        visibility = "on";
                        break;

                    case MapVisibility.Off:
                        visibility = "off";
                        break;

                    case MapVisibility.Simplified:
                        visibility = "simplified";
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    styleComponents.Add("visibility:" + visibility);
                }

                parametersList.Add("style", string.Join("|", styleComponents));
            }

            IList <Marker> markers = request.Markers;

            if (markers != null)
            {
                foreach (Marker marker in markers)
                {
                    var markerStyleParams = new List <string>();

                    MarkerStyle markerStyle = marker.Style;
                    if (markerStyle != null)
                    {
                        if (string.IsNullOrWhiteSpace(markerStyle.Color))
                        {
                            throw new ArgumentException("Marker style color can't be empty");
                        }

                        markerStyleParams.Add("color:" + markerStyle.Color);

                        if (!string.IsNullOrWhiteSpace(markerStyle.Label))
                        {
                            markerStyleParams.Add("label:" + markerStyle.Label);
                        }

                        if (markerStyle.Size != default(MarkerSize))
                        {
                            switch (markerStyle.Size)
                            {
                            case MarkerSize.Mid:
                                markerStyleParams.Add("size:mid");
                                break;

                            case MarkerSize.Tiny:
                                markerStyleParams.Add("size:tiny");
                                break;

                            case MarkerSize.Small:
                                markerStyleParams.Add("size:small");
                                break;

                            default:
                                throw new ArgumentOutOfRangeException();
                            }
                        }
                    }

                    string styleString = string.Join("|", markerStyleParams);

                    string locations = string.Join("|", marker.Locations.Select(location => location.LocationString));

                    parametersList.Add("markers", string.Format("{0}|{1}", styleString, locations));
                }
            }

            IList <Path> pathes = request.Pathes;

            if (pathes != null)
            {
                foreach (Path path in pathes)
                {
                    var pathStyleParams = new List <string>();

                    PathStyle pathStyle = path.Style;

                    if (pathStyle != null)
                    {
                        if (string.IsNullOrWhiteSpace(pathStyle.Color))
                        {
                            throw new ArgumentException("Path style color can't be empty");
                        }

                        pathStyleParams.Add("color:" + pathStyle.Color);

                        if (!string.IsNullOrWhiteSpace(pathStyle.FillColor))
                        {
                            pathStyleParams.Add("fillcolor:" + pathStyle.FillColor);
                        }

                        if (pathStyle.Weight != default(int))
                        {
                            pathStyleParams.Add("weight:" + pathStyle.Weight);
                        }
                    }

                    string styleString = string.Join("|", pathStyleParams);

                    string locations = string.Join("|", path.Locations.Select(location => location.LocationString));

                    parametersList.Add("path", string.Format("{0}|{1}", styleString, locations));
                }
            }

            return(scheme + BaseUrl + "?" + parametersList.GetQueryStringPostfix());
        }