Exemple #1
0
        /// <summary>
        /// Loads all circular arcs from an NTX file.
        /// </summary>
        /// <param name="fileName">The name of the NTX file to read from</param>
        /// <param name="creator">The edit that's being used to perform the import</param>
        /// <returns>The loaded features</returns>
        internal List <ArcFeature> LoadArcs(string fileName, Operation creator)
        {
            Ntx.File file = new Ntx.File();

            try
            {
                file.Open(fileName);
                List <ArcFeature> result = new List <ArcFeature>(1000);
                ILength           tol    = GetPointMatchTolerance(file);

                while (file.GetMore())
                {
                    if (file.DataType == (int)Ntx.DataType.Line && file.Line.IsCurve)
                    {
                        ArcFeature f = ImportArc(file.Line, creator, tol);
                        if (f != null)
                        {
                            result.Add((ArcFeature)f);
                        }
                    }
                }
                return(result);
            }

            finally
            {
                file.Close();
            }
        }
Exemple #2
0
        /// <summary>
        /// Loads all point features (symbols) from an NTX file.
        /// </summary>
        /// <param name="fileName">The name of the NTX file to read from</param>
        /// <param name="creator">The edit that's being used to perform the import</param>
        /// <returns>The loaded points</returns>
        internal List <PointFeature> LoadPoints(string fileName, Operation creator)
        {
            Ntx.File file = new Ntx.File();

            try
            {
                file.Open(fileName);
                List <PointFeature> result = new List <PointFeature>(1000);
                while (file.GetMore())
                {
                    if (file.DataType == (int)Ntx.DataType.Symbol)
                    {
                        Feature f = ImportSymbol(file.Symbol, creator);
                        if (f != null)
                        {
                            result.Add((PointFeature)f);
                        }
                    }
                }
                return(result);
            }

            finally
            {
                file.Close();
            }
        }
Exemple #3
0
        internal override Feature[] LoadFeatures(string fileName, Operation creator)
        {
            // First load all point features
            Trace.Write("Loading points");
            List <PointFeature> points = LoadPoints(fileName, creator);

            m_Result.AddRange(points.ToArray());

            // Create a spatial index for the points
            foreach (PointFeature p in points)
            {
                m_Index.Add(p);
            }

            // Load circular arcs
            Trace.Write("Loading circular arcs");
            List <ArcFeature> arcs = LoadArcs(fileName, creator);

            m_Result.AddRange(arcs.ToArray());

            // Now load everything except points
            Trace.Write("Loading data");
            Ntx.File file = new Ntx.File();

            try
            {
                file.Open(fileName);

                // Define line end point tolerance
                ILength tol = GetPointMatchTolerance(file);

                while (file.GetMore())
                {
                    Feature f = null;

                    if (file.DataType == (int)Ntx.DataType.Line && !file.Line.IsCurve)
                    {
                        f = ImportLine(tol, file.Line, creator);
                    }
                    else if (file.DataType == (int)Ntx.DataType.Name)
                    {
                        f = ImportName(file.Name, creator);
                    }

                    if (f != null)
                    {
                        m_Result.Add(f);
                    }
                }

                // Mark all features as moved, so they will be intersected against the map model
                //SetMoved(m_Result);

                return(m_Result.ToArray());
            }

            finally
            {
                file.Close();
            }
        }
Exemple #4
0
        /// <summary>
        /// Loads all circular arcs from an NTX file.
        /// </summary>
        /// <param name="fileName">The name of the NTX file to read from</param>
        /// <param name="creator">The edit that's being used to perform the import</param>
        /// <returns>The loaded features</returns>
        internal List<ArcFeature> LoadArcs(string fileName, Operation creator)
        {
            Ntx.File file = new Ntx.File();

            try
            {
                file.Open(fileName);
                List<ArcFeature> result = new List<ArcFeature>(1000);
                ILength tol = GetPointMatchTolerance(file);

                while (file.GetMore())
                {
                    if (file.DataType == (int)Ntx.DataType.Line && file.Line.IsCurve)
                    {
                        ArcFeature f = ImportArc(file.Line, creator, tol);
                        if (f!=null)
                            result.Add((ArcFeature)f);
                    }
                }
                return result;
            }

            finally
            {
                file.Close();
            }
        }
Exemple #5
0
        /// <summary>
        /// Loads all point features (symbols) from an NTX file.
        /// </summary>
        /// <param name="fileName">The name of the NTX file to read from</param>
        /// <param name="creator">The edit that's being used to perform the import</param>
        /// <returns>The loaded points</returns>
        internal List<PointFeature> LoadPoints(string fileName, Operation creator)
        {
            Ntx.File file = new Ntx.File();

            try
            {
                file.Open(fileName);
                List<PointFeature> result = new List<PointFeature>(1000);
                while (file.GetMore())
                {
                    if (file.DataType == (int)Ntx.DataType.Symbol)
                    {
                        Feature f = ImportSymbol(file.Symbol, creator);
                        if (f!=null)
                            result.Add((PointFeature)f);
                    }
                }
                return result;
            }

            finally
            {
                file.Close();
            }
        }
Exemple #6
0
        internal override Feature[] LoadFeatures(string fileName, Operation creator)
        {
            // First load all point features
            Trace.Write("Loading points");
            List<PointFeature> points = LoadPoints(fileName, creator);
            m_Result.AddRange(points.ToArray());

            // Create a spatial index for the points
            foreach (PointFeature p in points)
                m_Index.Add(p);

            // Load circular arcs
            Trace.Write("Loading circular arcs");
            List<ArcFeature> arcs = LoadArcs(fileName, creator);
            m_Result.AddRange(arcs.ToArray());

            // Now load everything except points
            Trace.Write("Loading data");
            Ntx.File file = new Ntx.File();

            try
            {
                file.Open(fileName);

                // Define line end point tolerance
                ILength tol = GetPointMatchTolerance(file);

                while (file.GetMore())
                {
                    Feature f = null;

                    if (file.DataType == (int)Ntx.DataType.Line && !file.Line.IsCurve)
                        f = ImportLine(tol, file.Line, creator);
                    else if (file.DataType == (int)Ntx.DataType.Name)
                        f = ImportName(file.Name, creator);

                    if (f!=null)
                        m_Result.Add(f);
                }

                // Mark all features as moved, so they will be intersected against the map model
                //SetMoved(m_Result);

                return m_Result.ToArray();
            }

            finally
            {
                file.Close();
            }
        }