Ejemplo n.º 1
0
        private bool ApplyOnObjects(ThemeLayer themelayer, List <Transform> layeredObjects, ThemeType themeType)
        {
            if (layeredObjects != null && layeredObjects.Count > 0)
            {
                foreach (Transform obj in layeredObjects)
                {
                    for (int i = 0; i < currentColorsList.Count; i++)
                    {
                        if (currentColorsList[i].name.Equals(themelayer.ToString()))
                        {
                            JMRColorTheme.SetColor(obj, currentColorsList[i].color);
                        }
                    }
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
        public static List <Transform> GetDesignAssetsInSpecifiedLayer(ThemeLayer themeLayer, List <Transform> assetList)
        {
            List <LayerCategory> filteredObjects = FilterAllDesignAssetsInProject();

            return(filteredObjects.Where(x => x.layerName.Equals(themeLayer.ToString())).First().layerObjectsPool);
        }
Ejemplo n.º 3
0
        void initlayerwindow(object sender, EventArgs e)
        {
            _layersWindow = new LayersWindow(profilethemeview, _view.map.Layers);
            //_layersWindow.Owner = App.Current.MainWindow;
            _layersWindow.Title = _view.eMap.MapID + ":图层";

            // Two ways to use delegate
            //_layersWindow.Closed += delegate { _layersWindow = null; };
            //_layersWindow.Closed += delegate(object o, EventArgs args) { _layersWindow = null; };

            // Use lamda function
            //_layersWindow.Closed += (o, args) =>
            //{
            //    _layersWindow = null;
            //};

            _layersWindow.OffLayerCheckBoxClick += (o, args) =>
            {
                if (args.Item.themelayer != null)
                {
                    ThemeLayer _tl = args.Item.themelayer;
                    foreach (string st in _tl.layernames)
                    {
                        Layer layer = _view.map.Layers.FirstOrDefault(x => x.ID == st);
                        if (layer != null)
                        {
                            layer.IsVisible = false;
                        }
                    }
                    Layer _layer = _view.map.Layers.FirstOrDefault(x => x.ID == _tl.tpkname + ".tpk");
                    if (_layer != null)
                    {
                        _layer.IsVisible = false;
                    }
                }
                else if (args.Item.themesection != null)
                {
                    ThemeSection _ts = args.Item.themesection;
                    foreach (string st in _ts.layernames)
                    {
                        Layer layer = _view.map.Layers.FirstOrDefault(x => x.ID == st);
                        if (layer != null)
                        {
                            layer.IsVisible = false;
                        }
                    }
                }
            };
            _layersWindow.OnLayerCheckBoxClick += (o, args) =>
            {
                if (args.Item.themelayer != null)
                {
                    ThemeLayer _tl = args.Item.themelayer;
                    foreach (string st in _tl.layernames)
                    {
                        Layer layer = _view.map.Layers.FirstOrDefault(x => x.ID == st);
                        if (layer != null)
                        {
                            layer.IsVisible = true;
                        }
                    }
                    Layer _layer = _view.map.Layers.FirstOrDefault(x => x.ID == _tl.tpkname + ".tpk");
                    if (_layer != null)
                    {
                        _layer.IsVisible = true;
                    }
                }
            };
            _view._layerswindow    = _layersWindow;
            _view.profilethemeview = profilethemeview;
            initshowlayer();

            // Globals.mainFrame.viewLoaded+=initshowlayer;
            Globals.mainFrame.viewLoaded -= initlayerwindow;
        }
Ejemplo n.º 4
0
 private bool ApplyColorOnSpecifiedLayer(ThemeLayer themelayer, ThemeType themeType, List <Transform> assetsList)
 {
     return(ApplyOnObjects(themelayer, assetsList, themeType));
 }
Ejemplo n.º 5
0
        public void Loadcsvfile()
        {
            try
            {
                string exeLocation       = System.IO.Directory.GetCurrentDirectory();
                string csvDestnationPath = "c:\\LaoYingData\\theme";

                if (!Directory.Exists(csvDestnationPath))
                {
                    return;
                }
                //第一列是TPK文件,第二列是geodatabse文件,第三列是图层名
                //加载剖面主题图信息
                foreach (string fp in profilethemelist)
                {
                    ThemeSection _themesection = new ThemeSection();
                    _themesection.name = fp;

                    string       exeDestnationPath = csvDestnationPath + "\\" + fp + ".csv";
                    StreamReader sr = new StreamReader(exeDestnationPath, Encoding.Default);
                    String       line;
                    ThemeLayer   themelayer = new ThemeLayer();
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.Length == 0)
                        {
                            continue;
                        }
                        string[] str = line.Split(',');
                        if ((str[0] != null) && (str[0] != ""))
                        {
                            ThemeLayer _themelayer = _themesection.themelayers.FirstOrDefault(x => x.tpkname == str[0]);
                            if (_themelayer == null)
                            {
                                _themelayer         = new ThemeLayer();
                                _themelayer.tpkname = str[0];
                                if ((str[2] != null) && (str[2] != ""))
                                {
                                    _themelayer.layernames.Add(str[2]);
                                }
                                _themesection.themelayers.Add(_themelayer);
                            }
                            else
                            {
                                if ((str[2] != null) && (str[2] != ""))
                                {
                                    _themelayer.layernames.Add(str[2]);
                                }
                            }
                            if (str[0].Contains("无tpk"))
                            {
                                _themesection.layernames.Add(str[2]);
                            }
                        }

                        //Add a new relationship between a geofile and a layer
                        if ((str[2] != null) && (str[2] != "") && (str[1] != "") && (null != str[1]))
                        {
                            if (!LayerToGeofile.ContainsKey(str[2]))
                            {
                                LayerToGeofile.Add(str[2], str[1]);
                            }
                        }
                    }
                    profilethemeview.themesections.Add(_themesection);
                }
            }
            catch (Exception ex)
            {
            }
        }