示例#1
0
        /// <summary>
        /// This handles the coloring aspects of selecting all the shapes in a shapefile layer
        /// </summary>
        public void Highlight_Layer(int Layer)
        {
            object ob = m_Map.get_GetObject(Layer);

            if (ob.GetType() != typeof(MapWinGIS.Shapefile))
            {
                return;                                              // Don't bother selecting images
            }
            int numLayers = m_Map.NumLayers;

            m_OriginalThickness  = new Hashtable[numLayers];
            m_OriginalLineColor  = new Hashtable[numLayers];
            m_OriginalPointColor = new Hashtable[numLayers];
            m_OriginalFillColor  = new Hashtable[numLayers];

            UInt32 SelCol = Convert.ToUInt32(m_SelectionColor.B) * 256 * 256 +
                            Convert.ToUInt32(m_SelectionColor.G) * 256 +
                            Convert.ToUInt32(m_SelectionColor.R);

            MapWinGIS.Shapefile sf = ob as MapWinGIS.Shapefile;
            if (sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POLYGON ||
                sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POLYGONM ||
                sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POLYGONZ)
            {
                for (int shp = 0; shp < m_SelectedShapes[Layer].Count; shp++)
                {
                    int Shape = m_SelectedShapes[Layer][shp];
                    m_OriginalFillColor[Layer].Add(Shape, m_Map.get_ShapeFillColor(Layer, Shape));
                    m_Map.set_ShapeFillColor(Layer, Shape, SelCol);
                    m_OriginalLineColor[Layer].Add(Shape, m_Map.get_ShapeLineColor(Layer, Shape));
                    m_Map.set_ShapeLineColor(Layer, Shape, SelCol);
                }
            }
            else if (sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POLYLINE ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POLYLINEM ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POLYLINEZ)
            {
                for (int shp = 0; shp < m_SelectedShapes[Layer].Count; shp++)
                {
                    int Shape = m_SelectedShapes[Layer][shp];
                    m_OriginalThickness[Layer].Add(Shape, m_Map.get_ShapeLineWidth(Layer, Shape));
                    m_Map.set_ShapeLineWidth(Layer, Shape, 3);
                    m_OriginalLineColor[Layer].Add(Shape, m_Map.get_ShapeLineColor(Layer, Shape));
                    m_Map.set_ShapeLineColor(Layer, Shape, SelCol);
                }
            }
            else if (sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POINT ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POINTM ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_POINTZ ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_MULTIPOINT ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_MULTIPOINTM ||
                     sf.ShapefileType == MapWinGIS.ShpfileType.SHP_MULTIPOINTZ)
            {
                for (int shp = 0; shp < m_SelectedShapes[Layer].Count; shp++)
                {
                    int   Shape = m_SelectedShapes[Layer][shp];
                    float Size  = m_Map.get_ShapePointSize(Layer, Shape);
                    m_OriginalThickness[Layer].Add(Shape, Size);
                    m_Map.set_ShapePointSize(Layer, Shape, Size + 2);
                    m_OriginalPointColor[Layer].Add(Shape, m_Map.get_ShapePointColor(Layer, Shape));
                    m_Map.set_ShapePointColor(Layer, Shape, SelCol);
                }
            }
        }