Esempio n. 1
0
        protected override void OnInit(EventArgs e)
        {
            if (Request.QueryString["color"] != null)
            {
                CreateImage();
                return;
            }
            base.OnInit(e);

            if (!IsPostBack)
            {
                var googleMapsEnabled = true;
                var usuario           = DAOFactory.UsuarioDAO.FindById(WebSecurity.AuthenticatedUser.Id);
                if (usuario != null && usuario.PorEmpresa && usuario.Empresas.Count == 1)
                {
                    var empresa = usuario.Empresas.First() as Empresa;
                    if (empresa != null)
                    {
                        googleMapsEnabled = empresa.GoogleMapsEnabled;
                    }
                }

                Monitor1.EnableTimer = false;
                Monitor1.Initialize(googleMapsEnabled);
                Monitor1.AddLayers(LayerFactory.GetVector(LayerRecorrido, true),
                                   LayerFactory.GetMarkers(LayerEntregas, true));
            }
        }
Esempio n. 2
0
        private void button_showOnMap_Click(object sender, EventArgs e)
        {
            List <NamedXyz> coordsB = this.ShowCoordsA;

            if (ShowLayer != null && coordsB != null)
            {
                List <AnyInfo.Geometries.Point> lonlats = new List <AnyInfo.Geometries.Point>();
                int i = 1;
                foreach (var g in coordsB)
                {
                    var find = this.ShowCoordsB.Find(m => String.Equals(m.Name, g.Name, StringComparison.CurrentCultureIgnoreCase));
                    if (find == null)
                    {
                        continue;
                    }

                    var geoCoord = Geo.Coordinates.CoordTransformer.XyzToGeoCoord(g.Value);
                    var name     = find.Name;// + ","  + find.Value.ToString();
                    lonlats.Add(new AnyInfo.Geometries.Point(geoCoord, (i++) + "", name));
                }
                Layer layer = LayerFactory.CreatePointLayer(lonlats);
                ShowLayer(layer);
            }
            else
            {
                MessageBox.Show("请先读取!");
            }
        }
Esempio n. 3
0
        private void GetFeaturesAndAddAttachment()
        {
            // open the geodatabase
            using (var geodatabase = new Geodatabase(@"c:\ProSDKWorkshop\data\generic.gdb"))
            {
                // open the SamplePoints feature class
                var pointFeatureClass = geodatabase.OpenDataset <FeatureClass>("SamplePoints");

                // retrieve all features from the feature class
                using (var rowCursor = pointFeatureClass.Search())
                {
                    while (rowCursor.MoveNext())
                    {
                        // for each feature
                        using (var currentFeature = rowCursor.Current as Feature)
                        {
                            // add the sample picture as an attachment
                            currentFeature.AddAttachment(new Attachment("SamplePicture", "image/png",
                                                                        CreateMemoryStreamFromContentsOf(@"c:\ProSDKWorkshop\data\redlands.png")));
                        }
                    }
                }
            }

            // add the feature class as a layer to the active map
            LayerFactory.CreateFeatureLayer(new Uri(@"c:\ProSDKWorkshop\data\generic.gdb\SamplePoints"), MapView.Active.Map);
        }
Esempio n. 4
0
        public object Clone()
        {
            GeoServicesClass clone = new GeoServicesClass(_dataset);

            clone._clonedThemes = new List <IWebServiceTheme>();

            var themes = (_clonedThemes != null) ?
                         _clonedThemes :
                         (_dataset?._themes ?? new List <IWebServiceTheme>());

            foreach (IWebServiceTheme theme in themes)
            {
                if (theme == null || theme.Class == null)
                {
                    continue;
                }

                clone._clonedThemes.Add(LayerFactory.Create(
                                            theme.Class,
                                            theme as ILayer, clone) as IWebServiceTheme);
            }
            clone.BeforeMapRequest    = BeforeMapRequest;
            clone.AfterMapRequest     = AfterMapRequest;
            clone.ModifyResponseOuput = ModifyResponseOuput;
            return(clone);
        }
        private void GetFeaturesAndAddAttachment()
        {
            // TODO
            // open the file geodatabase c:\ProSDKWorkshop\data\generic.gdb
            using (Geodatabase geodatabase = new Geodatabase(@"c:\ProSDKWorkshop\data\generic.gdb"))
            {
                using (FeatureClass pointFeatureClass = geodatabase.OpenDataset <FeatureClass>("SamplePoints"))
                {
                    using (RowCursor features = pointFeatureClass.Search())
                    {
                        while (features.MoveNext())
                        {
                            Feature currentFeature = features.Current as Feature;
                            currentFeature.AddAttachment(new Attachment("SamplePicture", "image/png",
                                                                        CreateMemoryStreamFromContentsOf(@"C:\ProSDKWorkshop\data\redlands.png")));
                        }
                    }
                }
            }

            // TODO
            // open the SamplePoints feature class

            // TODO
            // retrieve all features by searching the feature class

            // TODO
            // for each feature add the attachment

            // TODO
            // add the sample picture as an attachment

            // add the feature class as a layer to the active map
            LayerFactory.CreateFeatureLayer(new Uri(@"c:\ProSDKWorkshop\data\generic.gdb\SamplePoints"), MapView.Active.Map);
        }
Esempio n. 6
0
        private void button_showOnMap_Click(object sender, EventArgs e)
        {
            if (ShowLayer != null && this.param != null)
            {
                double time = 0;
                OrbitParamCaculator caculator = new OrbitParamCaculator();
                List <XYZ>          xyzs      = new List <XYZ>();
                for (int i = 0; i < 500; i++)
                {
                    time = i * 10000;
                    XYZ xyz = caculator.GetSatPos(param, time);
                    xyzs.Add(xyz);
                }


                List <AnyInfo.Geometries.Point> lonlats = new List <AnyInfo.Geometries.Point>();
                int j = 0;
                foreach (var item in xyzs)
                {
                    GeoCoord geoCoord = CoordTransformer.XyzToGeoCoord(item);
                    lonlats.Add(new AnyInfo.Geometries.Point(geoCoord, j + ""));
                    j++;
                }
                Layer layer = LayerFactory.CreatePointLayer(lonlats);
                ShowLayer(layer);
            }
        }
Esempio n. 7
0
        // Decode a single layer
        private static string DecodeLayer(int index, string payload, IDecoder decoder)
        {
            switch(index)
            {
                // Decode layer using the appropriate layer logic and selected decoder
                case 0:
                    return LayerFactory.InitializeLayer(LayerEnum.Layer0).Decode(payload, decoder);

                case 1:
                    return LayerFactory.InitializeLayer(LayerEnum.Layer1).Decode(payload, decoder);

                case 2:
                    return LayerFactory.InitializeLayer(LayerEnum.Layer2).Decode(payload, decoder);

                case 3:
                    return LayerFactory.InitializeLayer(LayerEnum.Layer3).Decode(payload, decoder);

                case 4:
                    return LayerFactory.InitializeLayer(LayerEnum.Layer4).Decode(payload, decoder);

                case 5:
                    return LayerFactory.InitializeLayer(LayerEnum.Layer5).Decode(payload, decoder);

                default:
                    throw new ArgumentException("Invalid layer index provided");
            }
        }
Esempio n. 8
0
 public override void OnClick()
 {
     if (RuleSetMessage.imagePath != null)
     {
         ILayer layer = LayerFactory.CreateDefaultLayer(RuleSetMessage.imagePath);
     }
 }
Esempio n. 9
0
        /// <summary>
        /// 建立图层
        /// </summary>
        /// <returns></returns>
        public Layer Build()
        {
            int          index   = 0;
            List <Point> lonLats = new List <Point>();

            foreach (var item in _results.ToArray())
            {
                index++;
                if (index > start)
                {
                    var single   = item;
                    var geoCoord = Geo.Coordinates.CoordTransformer.XyzToGeoCoord(item.Value.Value);
                    var pt       = new Point(geoCoord, index.ToString(), item.Name);
                    lonLats.Add(pt);
                }
            }

            Layer layer = LayerFactory.CreatePointLayer(lonLats);

            foreach (var item in dicData)
            {
                CreatePtFeature(layer, item.Value, item.Key);
            }

            layer.FeatureSource.BuildIndexing();
            layer.UseLayerStyle = false;
            return(layer);
        }
Esempio n. 10
0
        private void InitializeMap()
        {
            Monitor.EnableTimer    = false;
            Monitor.MultiplePopUps = true;

            var googleMapsEnabled = true;
            var usuario           = DAOFactory.UsuarioDAO.FindById(WebSecurity.AuthenticatedUser.Id);

            if (usuario != null && usuario.PorEmpresa && usuario.Empresas.Count == 1)
            {
                var empresa = usuario.Empresas.First() as Empresa;
                if (empresa != null)
                {
                    googleMapsEnabled = empresa.GoogleMapsEnabled;
                }
            }

            Monitor.Initialize(googleMapsEnabled);
            Monitor.AddLayers(LayerFactory.GetVector(Layers.Recorrido, true),
                              LayerFactory.GetVector(Layers.MensajesDuracion, true),
                              LayerFactory.GetVector(Layers.Geocercas, true),
                              LayerFactory.GetMarkers(Layers.PuntosDeInteres, true),
                              LayerFactory.GetMarkers(Layers.Mensajes, true),
                              LayerFactory.GetMarkers(Layers.Eventos, true));

            Monitor.AddControls(ControlFactory.GetToolbar(false, false, false, false, false, true, true));

            Monitor.ZoomTo(8);
            Monitor.Hide();

            //this.RegisterStartupJScript("map", string.Format("var map = $M('{0}');", (object) Monitor.MapDivId));
            this.RegisterStartupJScript("map", string.Format("var map = null;", (object)Monitor.MapDivId));
        }
Esempio n. 11
0
 public ExtensionLoader(LayerFactory _layerFactory, GeometryFactory _geometryFactory)
 {
     codeProvider    = new CSharpCodeProvider();
     compiler        = codeProvider.CreateCompiler();
     layerFactory    = _layerFactory;
     geometryFactory = _geometryFactory;
 }
Esempio n. 12
0
        /// <summary>
        /// Creates Kohonen network architecture with specified number of neurons in
        /// input and map layer
        /// </summary>
        /// <param name="inputNeuronsCount">
        ///            number of neurons in input layer </param>
        /// <param name="outputNeuronsCount">
        ///            number of neurons in output layer </param>
        private void createNetwork(int inputNeuronsCount, int outputNeuronsCount)
        {
            // specify input neuron properties (use default: weighted sum input with
            // linear transfer)
            NeuronProperties inputNeuronProperties = new NeuronProperties();

            // specify map neuron properties
            NeuronProperties outputNeuronProperties = new NeuronProperties(typeof(Neuron), typeof(Difference), typeof(Linear));             // transfer function -  input function -  neuron type

            // set network type
            this.NetworkType = NeuralNetworkType.KOHONEN;

            // createLayer input layer
            Layer inLayer = LayerFactory.createLayer(inputNeuronsCount, inputNeuronProperties);

            this.addLayer(inLayer);

            // createLayer map layer
            Layer mapLayer = LayerFactory.createLayer(outputNeuronsCount, outputNeuronProperties);

            this.addLayer(mapLayer);

            // createLayer full connectivity between input and output layer
            ConnectionFactory.fullConnect(inLayer, mapLayer);

            // set network input and output cells
            NeuralNetworkFactory.DefaultIO = this;

            this.LearningRule = new KohonenLearning();
        }
Esempio n. 13
0
        private void AddDataset(IDataset dataset)
        {
            if (dataset == null || dataset.Elements == null)
            {
                return;
            }

            if (dataset.State != DatasetState.opened)
            {
                if (!dataset.Open())
                {
                    MessageBox.Show("Can't open dataset '" + dataset.DatasetName + "'.\n" + dataset.lastErrorMsg);
                    return;
                }
            }

            foreach (IDatasetElement element in dataset.Elements)
            {
                if (element == null)
                {
                    continue;
                }
                ILayer layer = LayerFactory.Create(element.Class);

                dgLayers.Rows.Add(new object[] { true, element.Title, true });
                _elements.Add(new DatasetItemElement(dataset, layer));
            }
        }
Esempio n. 14
0
        public void OnEvent(object element, object dataset)
        {
            if (!(element is IFeatureLayer) || !(((IFeatureLayer)element).Class is IFeatureClass))
            {
                return;
            }

            ExportFeatureClassDialog dlg = new ExportFeatureClassDialog(
                ((_doc != null && _doc.FocusMap != null) ? _doc.FocusMap.Display : null),
                element as IFeatureLayer);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                IDatasetElement destElement = dlg.DestinationDatasetElement;
                if (destElement != null && destElement.Class != null)
                {
                    if (MessageBox.Show("Add new feature class to map?", "Add", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        ILayer layer = LayerFactory.Create(destElement.Class);
                        _doc.FocusMap.AddLayer(layer, 0);

                        if (_doc.Application is IMapApplication)
                        {
                            ((IMapApplication)_doc.Application).RefreshActiveMap(DrawPhase.All);
                        }
                    }
                }
            }
        }
Esempio n. 15
0
        protected void InitializeMonitor()
        {
            Monitor.DrawLine        += MonitorDrawLine;
            Monitor.FeatureModified += MonitorFeatureModified;
            Monitor.EnableTimer      = false;
            if (IsPostBack)
            {
                return;
            }

            Monitor.DrawLineMethod   = EventMethods.PostBack;
            Monitor.ModFeatureMethod = EventMethods.PostBack;

            Monitor.ImgPath          = Config.Monitor.GetMonitorImagesFolder(Page);
            Monitor.GoogleMapsScript = Config.Map.GoogleMapsKey;

            Monitor.AddLayers(LayerFactory.GetGoogleStreet(CultureManager.GetLabel("LAYER_GSTREET"), MinZoomLevel),
                              //LayerFactory.GetCompumap(CultureManager.GetLabel("LAYER_COMPUMAP"), Config.Map.CompumapTiles, MIN_ZOOM_LEVEL),
                              LayerFactory.GetOpenStreetMap(CultureManager.GetLabel("LAYER_OSM")),
                              LayerFactory.GetGoogleSatellite(CultureManager.GetLabel("LAYER_GSAT"), MinZoomLevel),
                              LayerFactory.GetGoogleHybrid(CultureManager.GetLabel("LAYER_GHIBRIDO"), MinZoomLevel),
                              LayerFactory.GetGooglePhysical(CultureManager.GetLabel("LAYER_GFISICO"), MinZoomLevel),
                              LayerFactory.GetVector(LayerRecorrido, true, StyleFactory.GetHandlePoint()),
                              LayerFactory.GetMarkers(LayerMarkers, true));

            Monitor.AddControls(ControlFactory.GetLayerSwitcher(),
                                ControlFactory.GetNavigation(),
                                ControlFactory.GetPanZoomBar(),
                                ControlFactory.GetToolbar(false, false, false, true, false, true, false, false, LayerRecorrido));
            if (MapLoad != null)
            {
                MapLoad(Monitor, EventArgs.Empty);
            }
        }
Esempio n. 16
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            SegClassForm segClassForm = new SegClassForm();

            segClassForm.ShowDialog();
            if (RuleSetMessage.OutShpPath != null || RuleSetMessage.OutClassResultsPath != null)
            {
                if (RuleSetMessage.OutShpPath != null)
                {
                    ILayer layer = LayerFactory.CreateDefaultLayer(RuleSetMessage.OutShpPath);
                    if (layer != null)
                    {
                        axMapControl2.FocusMap.AddLayer(layer);
                        axMapControl2.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);
                        RuleSetMessage.OutShpPath = null;
                    }
                }
                else
                {
                    ILayer layer = LayerFactory.CreateDefaultLayer(RuleSetMessage.OutClassResultsPath);
                    if (layer != null)
                    {
                        axMapControl2.FocusMap.AddLayer(layer);
                        axMapControl2.ActiveView.PartialRefresh(ViewDrawPhaseType.ViewAll);
                        RuleSetMessage.OutClassResultsPath = null;
                    }
                }
            }
        }
        private async Task <string> UploadImpl()
        {
            // Create EsriHttpClient object
            var httpClient = new EsriHttpClient();

            // Upload vtpk file to the currently active portal
            var itemToUpload = ItemFactory.Create(FilePath);
            var tags         = new string[] { "ArcGIS Pro", "SDK", "UploadVtpkToAgol Demo" };
            var portalUrl    = ArcGISPortalManager.Current.GetActivePortal().PortalUri.ToString();

            var result = httpClient.Upload(
                portalUrl, itemToUpload, string.Empty, tags);

            if (result.Item1 == false)
            {
                return($@"Unable to upload this item: {FilePath} to ArcGIS Online");
            }

            string userName = ArcGISPortalManager.Current.GetActivePortal().GetSignOnUsername();
            string query    = $@"q=owner:{userName} tags:""UploadVtpkToAgol Demo"" ";

            // Once uploaded make another REST call to search for the uploaded data
            var searchUrl = new UriBuilder(portalUrl)
            {
                Path  = "sharing/rest/search",
                Query = $@"{query}&f=json"
            };

            var searchResults = httpClient.Get(searchUrl.Uri.ToString());

            dynamic resultItems = JObject.Parse(await searchResults.Content.ReadAsStringAsync());

            long numberOfTotalItems = resultItems.total.Value;

            if (numberOfTotalItems == 0)
            {
                return($@"Unable to find uploaded item with query: {query}");
            }

            var resultItemList = new List <dynamic>();

            resultItemList.AddRange(resultItems.results);
            //get the first result
            dynamic item = resultItemList[0];

            // Create an item from the search results

            string itemId      = item.id;
            var    currentItem = ItemFactory.Create(itemId, ItemFactory.ItemType.PortalItem);

            // Finally add the feature service to the map
            // if we have an item that can be turned into a layer
            // add it to the map
            if (LayerFactory.CanCreateLayerFrom(currentItem))
            {
                LayerFactory.CreateLayer(currentItem, MapView.Active.Map);
            }
            return($@"Uploaded this item: {FilePath} to ArcGIS Online and added the item to the Map");
        }
Esempio n. 18
0
        /// <summary>
        /// Creates MultiLayerPerceptron Network architecture - fully connected
        /// feed forward with specified number of neurons in each layer
        /// </summary>
        /// <param name="neuronsInLayers">  collection of neuron numbers in getLayersIterator </param>
        /// <param name="neuronProperties"> neuron properties </param>
        private void createNetwork(List <int> neuronsInLayers, NeuronProperties neuronProperties)
        {
            // set network type
            this.NetworkType = NeuralNetworkType.MULTI_LAYER_PERCEPTRON;

            // create input layer
            NeuronProperties inputNeuronProperties = new NeuronProperties(typeof(InputNeuron), typeof(Linear));
            Layer            layer = LayerFactory.createLayer(neuronsInLayers[0], inputNeuronProperties);

            bool useBias = true;             // use bias neurons by default

            if (neuronProperties.hasProperty("useBias"))
            {
                useBias = (bool)neuronProperties.getProperty("useBias");
            }

            if (useBias)
            {
                layer.addNeuron(new BiasNeuron());
            }

            this.addLayer(layer);

            // create layers
            Layer prevLayer = layer;

            //for(Integer neuronsNum : neuronsInLayers)
            for (int layerIdx = 1; layerIdx < neuronsInLayers.Count; layerIdx++)
            {
                int neuronsNum = neuronsInLayers[layerIdx];
                // createLayer layer
                layer = LayerFactory.createLayer(neuronsNum, neuronProperties);

                if (useBias && (layerIdx < (neuronsInLayers.Count - 1)))
                {
                    layer.addNeuron(new BiasNeuron());
                }

                // add created layer to network
                this.addLayer(layer);
                // createLayer full connectivity between previous and this layer
                if (prevLayer != null)
                {
                    ConnectionFactory.fullConnect(prevLayer, layer);
                }

                prevLayer = layer;
            }

            // set input and output cells for network
            NeuralNetworkFactory.DefaultIO = this;

            // set learnng rule
            //        this.setLearningRule(new BackPropagation());
            this.LearningRule = new MomentumBackpropagation();
            // this.setLearningRule(new DynamicBackPropagation());

            this.randomizeWeights(new RangeRandomizer(-0.7, 0.7));
        }
Esempio n. 19
0
 public Task <IDatasetElement> Element(string title)
 {
     if (_fc != null)
     {
         return(Task.FromResult <IDatasetElement>(LayerFactory.Create(_fc)));
     }
     return(Task.FromResult <IDatasetElement>(null));
 }
 /// <summary>
 /// Adds a layer to the current map using the given path or url
 /// </summary>
 /// <remarks>Gets run in the worker thread</remarks>
 /// <param name="uri"></param>
 /// <returns></returns>
 public Task <Layer> AddLayer(string uri)
 {
     return(QueuedTask.Run(() =>
     {
         Map map = MapView.Active.Map;
         return LayerFactory.CreateLayer(new Uri(uri), map);
     }));
 }
Esempio n. 21
0
        private void PrepareLanguages(LayerFactory layerFactory)
        {
            mapLanguageTextBox.Leave += (_, __) => layerFactory.MapLanguage = mapLanguageTextBox.Text;
            layerFactory.MapLanguage  = mapLanguageTextBox.Text;

            trafficIncidentsLanguageTextBox.Leave += (_, __) => layerFactory.UserLanguage = trafficIncidentsLanguageTextBox.Text;
            layerFactory.UserLanguage              = trafficIncidentsLanguageTextBox.Text;
        }
Esempio n. 22
0
        public void Bind()
        {
            var windowFactory = new WindowFactory();
            var popUpFactory  = new PopUpFactory();
            var factory       = new LayerFactory(windowFactory, popUpFactory);

            _managerUi.Bind(factory);
        }
Esempio n. 23
0
 private void button_showOnMap_Click(object sender, EventArgs e)
 {
     if (ShowLayer != null && lonLats.Count != 0)
     {
         Layer layer = LayerFactory.CreatePointLayer(lonLats);
         ShowLayer(layer);
     }
 }
Esempio n. 24
0
 private void button_showOnMap_Click(object sender, EventArgs e)
 {
     if (showPointLayer != null && points != null)
     {
         Layer layer = LayerFactory.CreatePointLayer(points);
         showPointLayer(layer);
     }
 }
Esempio n. 25
0
        protected async override void OnClick()
        {
            //TODO - Get the URL of the Active Portal
            //HINT: Use PortalManager
            string portalUrl = PortalManager.GetActivePortal().ToString();

            UriBuilder searchURL = new UriBuilder(portalUrl);

            searchURL.Path = "sharing/rest/search";
            string layers = "(type:\"Map Service\" OR type:\"Image Service\" OR type:\"Feature Service\" OR type:\"WMS\" OR type:\"KML\")";

            //any public layer content
            searchURL.Query = string.Format("q={0}&f=json", layers);

            EsriHttpClient httpClient = new EsriHttpClient();

            var     searchResponse = httpClient.Get(searchURL.Uri.ToString());
            dynamic resultItems    = JObject.Parse(await searchResponse.Content.ReadAsStringAsync());

            //Use EsriHttpClient to call Online - Use the GET method

            //TODO get the JSON result from the searchResponse
            //HINT - examine methoods of searchResponse.Content

            //TODO Parse the returned JSON - here you will use the Newtonsoft library's JObject
            //examine JObject.Parse. Use a dynamic type to get the results of the Parse
            long numberOfTotalItems = resultItems.total.Value;

            if (numberOfTotalItems == 0)
            {
                return;
            }

            List <dynamic> resultItemList = new List <dynamic>();

            resultItemList.AddRange(resultItems.results);
            //TODO add the ".results" of the returned JSON.
            //eg: resultItemList.AddRange(resultItems.results);

            //get the first result from resultItemList (or an index of your choice)
            //dynamic item = ....
            dynamic item = resultItemList[0];


            //TODO create an Item via the ItemFactory. Use the ItemFactory.ItemType.PortalItem item type.
            string itemID      = item.id;
            Item   currentItem = ItemFactory.Create(itemID, ItemFactory.ItemType.PortalItem);

            await QueuedTask.Run(() => {
                // if we have an item that can be turned into a layer
                // add it to the map
                //TODO use the LayerFactory.CreateLayer and the MapView.Active.Map
                if (LayerFactory.CanCreateLayerFrom(currentItem))
                {
                    LayerFactory.CreateLayer(currentItem, MapView.Active.Map);
                }
            });
        }
Esempio n. 26
0
 private void button_drawOnMap_Click(object sender, EventArgs e)
 {
     if (ShowLayer != null && Headers != null)
     {
         List <AnyInfo.Geometries.Point> lonlats = GetPoints(Headers);
         Layer layer = LayerFactory.CreatePointLayer(lonlats);
         ShowLayer(layer);
     }
 }
Esempio n. 27
0
        public void InitLayers(Transform layersParent)
        {
            m_UILayers = new UILayer[(int)UILayerType.TYPE_MAX];
            m_UILayers[(int)UILayerType.TYPE_BASE]    = LayerFactory.CreateUILayer(UILayerType.TYPE_BASE, layersParent);
            m_UILayers[(int)UILayerType.TYPE_POP]     = LayerFactory.CreateUILayer(UILayerType.TYPE_POP, layersParent);
            m_UILayers[(int)UILayerType.TYPE_MESSAGE] = LayerFactory.CreateUILayer(UILayerType.TYPE_MESSAGE, layersParent);
            m_UILayers[(int)UILayerType.TYPE_DEATH]   = LayerFactory.CreateUILayer(UILayerType.TYPE_DEATH, layersParent);

            pop_Layer = m_UILayers[(int)UILayerType.TYPE_POP];
        }
Esempio n. 28
0
        public Task <List <IDatasetElement> > Elements()
        {
            List <IDatasetElement> elements = new List <IDatasetElement>();

            if (_fc != null)
            {
                elements.Add(LayerFactory.Create(_fc));
            }
            return(Task.FromResult(elements));
        }
Esempio n. 29
0
        // Prosessoi kaikki layerit.
        private void ProcessLayers(List <Tuple <string, int> > drawOrderPairs, IEnumerable <BaseSerializedLayer> serializedLayers)
        {
            LayerFactory layerFactory = new LayerFactory(game, map.TileEngine);
            SheetFactory sheetFactory = new SheetFactory();

            foreach (BaseSerializedLayer serializedLayer in serializedLayers)
            {
                // alustaa layerin
                Size   size  = new Size(serializedLayer.Width, serializedLayer.Height);
                ILayer layer = layerFactory.MakeNew(serializedLayer);

                // alustaa tilejen parametrit ja indeksoi ne
                TileParameters tileParameters = GetRightTileParameters(serializedLayer, map.TileEngine);

                // jos layeri on tilayeri, tehdään sille tile sheetti
                if (serializedLayer is SerializedTileLayer)
                {
                    SerializedTileLayer tileLayer = serializedLayer as SerializedTileLayer;
                    layer.Sheet = sheetFactory.MakeNew(layer.GetType(), new object[]
                    {
                        tileLayer.SheetPath, contentManager, map.TileEngine
                    });
                }
                // jos layeri on animaatio layeri, tehdään sille animaatio sheetti
                else if (serializedLayer is SerializedAnimationLayer)
                {
                    SerializedAnimationLayer animationLayer = serializedLayer as SerializedAnimationLayer;
                    layer.Sheet = sheetFactory.MakeNew(layer.GetType(), new object[]
                    {
                        animationLayer.SheetPath, contentManager, map.TileEngine,
                        new AnimationManager(animationLayer.AnimationManager.FrameCount, animationLayer.AnimationManager.FrameTime)
                    });
                }

                // alustaa layerin ja sen tilet
                layer.Initialize(tileParameters);
                // lisää layerin managerille
                map.LayerManager.AddLayer(layer);

                // jos layeri ei ole rule, otetaan sen draworder huomioon
                if (!(layer is Layer <RuleTile>))
                {
                    AddDrawOrder(drawOrderPairs, serializedLayer);
                }
                // prosessoidaan objectit jos layeri sisältää objecti tilejä
                if (layer is Layer <ObjectTile> )
                {
                    ProcessMapObjects(serializedLayer, layer);
                }

                // rakennetaan componentit layerille lopuksi
                ComponentBuilder componentBuilder = new ComponentBuilder(game);
                layer.Components.AddComponents(componentBuilder.BuildComponents(layer));
            }
        }
Esempio n. 30
0
        private List <BikeTouringGISLayer> GetLayers(string path)
        {
            var gpxData = GetGPXData(path);

            _vm.AddPoIs(gpxData.WayPoints);
            var layerFactory = new LayerFactory(gpxData.WayPointsExtent);

            _vm.AddRoutes(layerFactory.CreateRoutes("unittest", gpxData.Routes));
            _vm.BikeTouringGISLayers = new ObservableCollection <BikeTouringGISLayer>(_vm.Map.GetBikeTouringGISLayers());
            return(_vm.BikeTouringGISLayers.ToList());
        }