Esempio n. 1
0
 public PortalController(ITitleProvider titleProvider, IFaviconProvider faviconProvider, IStyleProvider styleProvider, IScriptProvider scriptProvider)
 {
     TitleProvider   = titleProvider;
     FaviconProvider = faviconProvider;
     StyleProvider   = styleProvider;
     ScriptProvider  = scriptProvider;
 }
Esempio n. 2
0
 static DefaultStyleProvider CreateDefaultProvider()
 {
     styles              = new DefaultStyleProvider();
     styles.StyleWidget += OnStyleWidget;
     Provider            = styles;
     return(styles);
 }
Esempio n. 3
0
 public PortalPageRenderer(ITitleProvider titleProvider, IFaviconProvider faviconProvider, IStaticFilesBasePathProvider staticFilesBasePathProvider, IStyleProvider styleProvider)
 {
     TitleProvider               = titleProvider;
     FaviconProvider             = faviconProvider;
     StaticFilesBasePathProvider = staticFilesBasePathProvider;
     StyleProvider               = styleProvider;
 }
Esempio n. 4
0
 private static CloudBuilder PrepareCloudBuilder(
     IWordsProvider wordsProvider,
     IStyleProvider styleProvider,
     ICloudLayouter layouter,
     ICloudSettingsProvider settingsProvider)
 {
     return(CloudBuilder.StartNew(layouter, settingsProvider)
            .WithWordsSize(word => TextRenderer.MeasureText(word, styleProvider.GetStyle(word).Font))
            .WithWords(wordsProvider.GetWords()));
 }
Esempio n. 5
0
 public CloudRenderer(
     IWordsProvider wordsProvider,
     IStyleProvider styleProvider,
     ICloudLayouter cloudLayouter,
     ICloudSettingsProvider settingsProvider)
 {
     this.styleProvider    = styleProvider;
     this.settingsProvider = settingsProvider;
     cloudBuilder          = PrepareCloudBuilder(wordsProvider, styleProvider, cloudLayouter, settingsProvider);
 }
        public virtual GeoJsonFeatureCollection ConvertFolder(KmlFolder folder, IStyleProvider provider)
        {
            GeoJsonFeatureCollection collection = new GeoJsonFeatureCollection();

            foreach (KmlFeature feature in folder.Features)
            {
                ConvertFolder(folder, collection, feature, provider);
            }

            return(collection);
        }
        public virtual GeoJsonFeature ConvertPlacemark(KmlPlacemark placemark, IStyleProvider provider)
        {
            // Initialize a new feature
            GeoJsonFeature feature = new GeoJsonFeature();

            // Convert the name and description
            if (placemark.Name.HasValue())
            {
                feature.Properties.Name = placemark.Name;
            }
            if (placemark.Description.HasValue())
            {
                feature.Properties.Description = placemark.Description;
            }

            switch (placemark.Geometry)
            {
            case KmlPoint point:
                feature.Geometry = Convert(point);
                break;

            case KmlLineString lineString:
                feature.Geometry = Convert(lineString);
                break;

            case KmlPolygon polygon:
                feature.Geometry = Convert(polygon);
                break;

            default:
                throw new KmlException("Geometry type " + placemark.Geometry.GetType() + " not supported");
            }

            if (string.IsNullOrWhiteSpace(placemark.StyleUrl) == false && provider != null)
            {
                if (provider.TryGetStyleMapById(placemark.StyleUrl.Substring(1), out KmlStyleMap styleMap))
                {
                    if (styleMap.Normal != null && provider.TryGetStyleById(styleMap.Normal.StyleUrl.Substring(1), out KmlStyle style))
                    {
                        ConvertProperties(style, feature.Properties);
                    }
                }
                else
                {
                    if (provider.TryGetStyleById(placemark.StyleUrl.Substring(1), out KmlStyle style))
                    {
                        ConvertProperties(style, feature.Properties);
                    }
                }
            }

            return(feature);
        }
Esempio n. 8
0
 public TreeRenderer(
     ILogger <TreeRenderer> log,
     IGraphVizWriter gvWriter,
     IStyleProvider style,
     IGraphTooltipHelper tooltipHelper,
     IRemoteWebUrlProviderFactory remoteWebUrlProviderFactory)
 {
     _log           = log;
     _gvWriter      = gvWriter;
     _style         = style;
     _tooltipHelper = tooltipHelper;
     _remoteWebUrlProviderFactory = remoteWebUrlProviderFactory;
 }
        public virtual GeoJsonObject ConvertFeature(KmlFeature feature, IStyleProvider provider)
        {
            switch (feature)
            {
            case KmlDocument document:
                throw new NotImplementedException();
            //return ConvertDocument(document, provider ?? document.StyleSelectors);

            case KmlFolder folder:
                return(ConvertFolder(folder, provider));

            case KmlPlacemark placemark:
                return(ConvertPlacemark(placemark, provider));

            default:
                throw new KmlException("Unsupported feature " + feature.GetType());
            }
        }
Esempio n. 10
0
 public DelegateTextWriter(TextWriter writer, IStyleProvider styleProvider) : base(null, styleProvider)
 {
     this.writer = writer;
 }
Esempio n. 11
0
 public DemoPageRenderer(IStaticFilesBasePathProvider staticFilesBasePathProvider, IStyleProvider styleProvider)
 {
     StaticFilesBasePathProvider = staticFilesBasePathProvider;
     StyleProvider = styleProvider;
 }
Esempio n. 12
0
 public StylesWriter(IStyleProvider styleProvider)
 {
     _styleProvider = styleProvider;
 }
Esempio n. 13
0
 public ConsoleTextWriter(IStyleProvider styleProvider) : base(null, styleProvider)
 {
 }
        protected virtual void ConvertFolder(KmlFolder folder, GeoJsonFeatureCollection collection, KmlFeature feature, IStyleProvider provider)
        {
            switch (feature)
            {
            case KmlPlacemark placemark:

                collection.Add(ConvertPlacemark(placemark, provider));

                break;

            case KmlDocument document:
            // Why would you have a document in a folder? (although it seems legal according to the specification)

            case KmlFolder childFolder:
            // Why would you have folder in another folder? (although it seems legal according to the specification)

            default:
                throw new KmlException("Unsupported feature " + feature.GetType());
            }
        }
Esempio n. 15
0
 public Legend(Graph graph, IStyleProvider style) : base()
 {
     this.Graph = graph;
     this.style = style;
 }
Esempio n. 16
0
 protected RichTextWriter(IFormatProvider formatProvider, IStyleProvider styleProvider) : base(formatProvider)
 {
     this.styleProvider = styleProvider;
     this.IndentPending = true;
 }
Esempio n. 17
0
 /* public methods */
 public Graph(IStyleProvider style) : base()
 {
     this.style_prov = style;
 }
        protected virtual GeoJsonFeatureCollection[] ConvertDocument(KmlDocument document, IStyleProvider provider)
        {
            // Use the style provider of the document if not explicitly specified
            provider = provider ?? document.StyleSelectors;

            // Initialize a new list of collections
            List <GeoJsonFeatureCollection> collections = new List <GeoJsonFeatureCollection>();

            if (document.Features.Any(x => x is KmlFolder))
            {
                GeoJsonFeatureCollection defaultCollection = null;

                foreach (KmlFeature feature in document.Features)
                {
                    switch (feature)
                    {
                    case KmlDocument _:
                        throw new KmlException("Weird place for a <Document>, huh?");

                    case KmlFolder folder:
                        collections.Add(ConvertFolder(folder, provider));
                        break;

                    case KmlPlacemark placemark:

                        // Make sure the default feature collection is initialized
                        if (defaultCollection == null)
                        {
                            collections.Add(defaultCollection = new GeoJsonFeatureCollection());
                        }

                        // As the placemark isn't located inside a folder, we should append it to a "default" feature collection"
                        defaultCollection.Add(ConvertPlacemark(placemark, provider));

                        break;

                    default:
                        throw new KmlException("Unsupported feature " + feature.GetType());
                    }
                }
            }
            else
            {
                GeoJsonFeatureCollection features = new GeoJsonFeatureCollection();

                foreach (KmlFeature feature in document.Features)
                {
                    switch (feature)
                    {
                    case KmlDocument _:
                        throw new KmlException("Weird place for a <Document>, huh?");

                    case KmlPlacemark placemark:
                        features.Add(ConvertPlacemark(placemark, provider));
                        break;

                    default:
                        throw new KmlException("Unsupported feature " + feature.GetType());
                    }
                }

                collections.Add(features);
            }

            return(collections.ToArray());
        }
Esempio n. 19
0
		public ConsoleTextWriter(IStyleProvider styleProvider): base(null, styleProvider) {}
Esempio n. 20
0
 public StylesWriter(IStyleProvider styleProvider)
 {
     _styleProvider = styleProvider;
 }