Esempio n. 1
0
        private void ARPopulateComboWithMapLayers(ComboBox Layers, System.Collections.Hashtable LayersIndex)
        {
            //In case cboLayers is already populated
            Layers.Items.Clear();
            LayersIndex.Clear();

            ARLayer arLayer;
            ARLayer arGroupLayer;

            // Get the focus map
            ARMap arMap = axArcReaderControl1.ARPageLayout.FocusARMap;

            // Loop through each layer in the focus map
            for (int i = 0; i <= arMap.ARLayerCount - 1; i++)
            {
                // Get the layer name and add to combo
                arLayer = arMap.get_ARLayer(i);
                if (arLayer.IsGroupLayer == true)
                {
                    //If a GroupLayer add the ARChildLayers to the combo and HashTable
                    for (int g = 0; g <= arLayer.ARLayerCount - 1; g++)
                    {
                        arGroupLayer = arMap.get_ARLayer(i).get_ChildARLayer(g);
                        Layers.Items.Add(arGroupLayer.Name);
                        LayersIndex.Add(Layers.Items.Count - 1, arGroupLayer);
                    }
                }
                else if (arLayer.Searchable == true)
                {
                    Layers.Items.Add(arLayer.Name);
                    LayersIndex.Add(Layers.Items.Count - 1, arLayer);
                }
            }
        }
        private void cmdMapProperties_Click(object sender, System.EventArgs e)
        {
            if (axArcReaderControl1.CurrentViewType == esriARViewType.esriARViewTypeNone)
            {
                System.Windows.Forms.MessageBox.Show("You must load a map document first!");
                return;
            }
            string sProps = "Map and Layer Properties" + "\xA" + "\xA";

            // Loop through each map in the document
            // Get the IARMap interface
            for (int i = 0; i <= axArcReaderControl1.ARPageLayout.ARMapCount - 1; i++)
            {
                ARMap map = axArcReaderControl1.ARPageLayout.get_ARMap(i);
                // Get map properties
                sProps = sProps + map.Name.ToUpper() + "\xA" + "Description:" + map.Description + "\xA" + "Spatial Reference:" + "\x9" + map.SpatialReferenceName + "\xA" + "Units:" + "\x9" + "\x9" + axArcReaderControl1.ARUnitConverter.EsriUnitsAsString(map.DistanceUnits, esriARCaseAppearance.esriARCaseAppearanceUnchanged, true) + "\xA";
                // Get map extent type
                esriARExtentType extent = axArcReaderControl1.ARPageLayout.get_MapExtentType(map);
                if (extent == esriARExtentType.esriARExtentTypeFixedExtent)
                {
                    sProps = sProps + "Extent Type:" + "\x9" + "Fixed Extent" + "\xA";
                }
                else if (extent == esriARExtentType.esriARExtentTypeFixedScale)
                {
                    sProps = sProps + "Extent Type:" + "\x9" + "Fixed Scale" + "\xA";
                }
                else
                {
                    sProps = sProps + "Extent Type:" + "\x9" + "Automatic" + "\xA";
                }
                sProps = sProps + "\xA";
                // Loop through each layer in the map
                // Get the IARLayer interface
                for (int j = 0; j <= map.ARLayerCount - 1; j++)
                {
                    IARLayer layer = map.get_ARLayer(j);
                    // Get the layer properties
                    sProps = sProps + layer.Name + "\xA" + "Description:" + "\x9" + layer.Description + "\xA" + "Minimum Scale:" + "\x9" + layer.MinimumScale + "\xA" + "Maximum Scale:" + "\x9" + layer.MaximumScale + "\xA" + "\xA";
                }
                sProps = sProps + "\xA";
            }
            RichTextBox1.Text = sProps;
        }