示例#1
0
        public frmMap(IEnvelope envelope, Topology.CoordinateSystems.ICoordinateSystem coordSys, params IProvider[] layers) : this()
        {
            m_isLoading = true;
            m_layers    = new List <IProvider>(layers);
            m_env       = m_origEnv = envelope;
            m_coordSys  = null;

            if (coordSys != null)
            {
                try
                {
                    //This fails because the XY-M projection is not supported
                    m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.ActualCoordinateSystem(coordSys);
                }
                catch { }
            }

            if (m_coordSys == null && coordSys != null)
            {
                Topology.CoordinateSystems.IUnit unit = coordSys.GetUnits(0);
                if (unit is Topology.CoordinateSystems.IAngularUnit)
                {
                    double radians = (unit as Topology.CoordinateSystems.IAngularUnit).RadiansPerUnit;
                    m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.DegreeBasedCoordinateSystem();
                }
                else if (unit is Topology.CoordinateSystems.ILinearUnit)
                {
                    m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.MeterBasedCoordsys(((Topology.CoordinateSystems.ILinearUnit)unit).MetersPerUnit, ((Topology.CoordinateSystems.ILinearUnit)unit).MetersPerUnit);
                }
            }


            if (m_coordSys == null)
            {
                m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.MeterBasedCoordsys();
            }


            foreach (IProvider l in m_layers)
            {
                LayerListBox.Items.Add(l.DatasetName, CheckState.Checked);
            }

            m_isLoading = false;
        }
        public frmMap(IEnvelope envelope, Topology.CoordinateSystems.ICoordinateSystem coordSys, params IProvider[] layers) : this()
        {
            m_isLoading = true;
            m_layers = new List<IProvider>(layers);
            m_env = m_origEnv = envelope;
            m_coordSys = null;

            if (coordSys != null)
                try
                {
                    //This fails because the XY-M projection is not supported
                    m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.ActualCoordinateSystem(coordSys);
                }
                catch { }

            if (m_coordSys == null && coordSys != null)
            {
                Topology.CoordinateSystems.IUnit unit = coordSys.GetUnits(0);
                if (unit is Topology.CoordinateSystems.IAngularUnit)
                {
                    double radians = (unit as Topology.CoordinateSystems.IAngularUnit).RadiansPerUnit;
                    m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.DegreeBasedCoordinateSystem();
                }
                else if (unit is Topology.CoordinateSystems.ILinearUnit)
                    m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.MeterBasedCoordsys(((Topology.CoordinateSystems.ILinearUnit)unit).MetersPerUnit, ((Topology.CoordinateSystems.ILinearUnit)unit).MetersPerUnit);
            }


            if (m_coordSys == null)
                m_coordSys = new LittleSharpRenderEngine.CoordinateSystem.MeterBasedCoordsys();


            foreach (IProvider l in m_layers)
                LayerListBox.Items.Add(l.DatasetName, CheckState.Checked);

            m_isLoading = false;
        }