Пример #1
0
        /*
         * public PreparedGeometryTeeOperation()
         * {
         * }
         */

        /// <summary>
        /// Creates a new operation which chains to the given <see cref="IGeometryOperation"/>
        /// for non-intercepted methods.
        /// </summary>
        /// <param name="chainOp">The operation to chain to</param>
        public PreparedGeometryTeeOperation(GeometryMethodOperation chainOp)
            : base(chainOp)
        {
        }
 /// <summary>
 /// Creates a new operation which chains to the given <see cref="IGeometryOperation"/>
 /// for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">The operation to chain to</param>
 public BufferValidatedGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }
 /// <summary>
 /// Creates a new operation which chains to the given {@link GeometryMethodOperation}
 /// for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">the operation to chain to</param>
 public OverlayValidatedGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }
        /**
         * Creates a new operation which chains to the given {@link GeometryMethodOperation}
         * for non-intercepted methods.
         *
         * @param chainOp the operation to chain to
         */

        public PreparedGeometryOperation(GeometryMethodOperation chainOp)
        {
            _chainOp = chainOp;
        }
 public Type GetReturnType(String opName)
 {
     return(GeometryMethodOperation.GetGeometryReturnType(opName));
 }
Пример #6
0
        public bool LoadFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                throw new ArgumentException(fileName, 
                    "The file does not exits or the 'fileName' is not valid.");
            }

            try
            {
                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(fileName);

                XmlElement root = xmldoc.DocumentElement;

                // Retrieve the "desc" tag, if any.
                XmlNode desc = root["desc"];
                string strTestDescription = String.Empty;
                if (desc != null && desc.InnerText.Length > 0)
                {
                    strTestDescription = desc.InnerText;
                }
                else
                {
                    strTestDescription = Path.GetFileNameWithoutExtension(fileName);
                }

                // Retrieve the "workspace", if any.
                XmlNode workspace = root["workspace"];
                if (workspace != null)
                {  
                    XmlAttributeCollection workspaceAttributes = workspace.Attributes;
                    if (workspaceAttributes != null && workspaceAttributes.Count > 0)
                    {
                        m_strTestWorkspace = workspaceAttributes["dir"].InnerText;
                    }
                }

                // Retrieve the "tolerance" attribute, if any.
                XmlNode tolerance = root["tolerance"];

                double dTolerance = 0.0;
                if (tolerance != null)
                {
                    string strTolerance = tolerance.InnerText;
                    try
                    {
                        dTolerance = Double.Parse(strTolerance, GetNumberFormatInfo());
                    }
                    catch (Exception ex)
                    {
                        XmlTestExceptionManager.Publish(ex);
                    }
                }

                // Retrieve the precisionName" tag, if any.
                PrecisionModel pm = null;
                XmlNode precision = root["precisionModel"];
                if (precision != null)
                {
                    XmlAttributeCollection precisionAttributes = precision.Attributes;
                    if (precisionAttributes != null && precisionAttributes.Count > 0)
                    {

                        XmlAttribute attribute = precisionAttributes["type"];
                        if (attribute != null)
                        {
                            string strPrecision = attribute.InnerText;

                            if (strPrecision == "FIXED" && precisionAttributes.Count == 4)
                            {
                                try
                                {
                                    double scale   =
                                        Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo());
                                    double offsetx =
                                        Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo());
                                    double offsety =
                                        Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo());

                                    pm = new PrecisionModel(scale);
                                }
                                catch (Exception ex)
                                {
                                    XmlTestExceptionManager.Publish(ex);
                                }
                            }
                            else
                            {
                                pm = new PrecisionModel();
                            }
                        }
                        else
                        {
                            if (precisionAttributes.Count == 3)
                            {
                                double scale   =
                                    Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo());
                                double offsetx =
                                    Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo());
                                double offsety =
                                    Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo());
 
                                pm = new PrecisionModel(scale);
                            }
                        }
                   }
                }

                if (pm == null)
                {
                    pm = new PrecisionModel();
                }

                IGeometryOperation geometryOperation = null;
                XmlNode go = root["geometryOperation"];
                if (go != null)
                {
                    go = go.FirstChild;
                    switch (go.Value)
                    {
                        case "com.vividsolutions.jtstest.geomop.PreparedGeometryOperation":
                            geometryOperation = new PreparedGeometryOperation();
                            break;
                        case "com.vividsolutions.jtstest.geomop.BufferValidatedGeometryOperation":
                            geometryOperation = new BufferValidatedGeometryOperation();
                            break;
                        case "com.vividsolutions.jtstest.geomop.OverlayValidatedGeometryOperation":
                            geometryOperation = new OverlayValidatedGeometryOperation();
                            break;
                            
                        default:
                            Console.WriteLine(string.Format("\n *** {0} *** \n", go.Value));
                            Console.ReadKey(true);
                            geometryOperation = new GeometryMethodOperation();
                            break;
                    }
                }

                IResultMatcher resultMatcher = null;
                XmlNode rm = root["resultMatcher"];
                if (rm != null)
                {
                    rm = rm.FirstChild;
                    if (rm.Value.EndsWith("BufferResultMatcher", StringComparison.InvariantCultureIgnoreCase))
                        resultMatcher = new BufferResultMatcher();
                    else
                    {
                        throw new NotSupportedException();
                    }
                }

                m_objFactory   = new XmlTestFactory(pm, geometryOperation, resultMatcher);
                m_listCurTests = new XmlTestCollection();

                m_listCurTests.Name = strTestDescription;

                // Now, handle the "case" nodes
                XmlNodeList elemList = xmldoc.GetElementsByTagName("case");
                for (int i = 0; i < elemList.Count; i++)
                {   
                    ParseCaseNode(elemList[i], dTolerance);
                }

                m_listarrTests.Add(m_listCurTests);

                return true;
            }
            catch (Exception ex)
            {
                XmlTestExceptionManager.Publish(ex);
                return false;
            }
        }
 /// <summary>
 /// Creates a new operation which chains to the given <see cref="IGeometryOperation"/> for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">The operation to chain to</param>
 protected TeeGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }
 /// <summary>
 /// Creates a new operation which chains to the given {@link GeometryMethodOperation}
 /// for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">the operation to chain to</param>
 public OverlayValidatedGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }
 /// <summary>
 /// Creates a new operation which chains to the given <see cref="IGeometryOperation"/> for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">The operation to chain to</param>
 protected TeeGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }
 /// <summary>
 /// Creates a new operation which chains to the given <see cref="IGeometryOperation"/>
 /// for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">The operation to chain to</param>
 public BufferValidatedGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }
        /*
        public PreparedGeometryTeeOperation()
        {
        }
         */

        /// <summary>
        /// Creates a new operation which chains to the given <see cref="IGeometryOperation"/>
        /// for non-intercepted methods.
        /// </summary>
        /// <param name="chainOp">The operation to chain to</param>
        public PreparedGeometryTeeOperation(GeometryMethodOperation chainOp)
            : base(chainOp)
        {
        }
 /// <summary>
 /// Creates a new operation which chains to the given {@link GeometryMethodOperation}
 /// for non-intercepted methods.
 /// </summary>
 /// <param name="chainOp">The operation to chain to</param>
 public PreparedGeometryOperation(GeometryMethodOperation chainOp)
 {
     _chainOp = chainOp;
 }