Ejemplo n.º 1
0
        /// <summary>
        /// 3D UZ !!!!
        /// Creates a dictionary with key equal to the model state index and the value the spatial information of that state index.
        /// </summary>
        /// <param name="gType">The geometric type of the exchange itme (2d or 3d)</param>
        /// <param name="baseOut">The exchange item base output</param>
        /// <param name="elementID">the string id of the exchange item.</param>
        /// <returns></returns>
        private IDictionary <int, ISpatialDefine> GetModelCoordinates3DUZ(GeometryTypes gType, IBaseOutput baseOut, string elementID)
        {
            IDictionary <int, ISpatialDefine> modelEntities = new Dictionary <int, ISpatialDefine>();
            int n;

            try
            {
                WMEngine.GetElementCount(elementID);
                n = baseOut.ElementSet().ElementCount;
            }
            catch
            {
                Console.WriteLine("\nElement {0} does not found in the model\n", elementID);
                throw new Exception("\nProblem in Model Instance - unable to find exchange item\n");
            }

            // Determines the number of layers in the UZ Grid.
            int numLayersInGrid = Convert.ToInt32(Math.Round((double)base.WMEngine.UzGrid.ElementCount / (double)base.WMEngine.UzGrid.BaseGrid.ElementCount));

            for (int i = 0; i < n; i++)
            {
                XYPolygon modelpolygon = ElementMapper.CreateXYPolygon(baseOut.ElementSet(), i);
                int       zLayer       = Convert.ToInt32(i % numLayersInGrid);

                // Points in Polygon are defined as LL, LR, UR, UL  (l/l = lower/left, u = upper, r = right )
                // Finds the mid x and mid y point in the polygon (assuming rectangular grid)
                IXYLayerPoint min = new XYLayerPoint(modelpolygon.GetX(0), modelpolygon.GetY(0), zLayer);
                IXYLayerPoint max = new XYLayerPoint(modelpolygon.GetX(1), modelpolygon.GetY(3), zLayer);

                modelEntities.Add(i, new SpatialDefine(min, max, GeometryTypes.Geometry3DUZ));
            }

            return(modelEntities);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 3D SZ !!!!
        /// Creates a dictionary with key equal to the model state index and the value the spatial information of that state index.
        /// </summary>
        /// <param name="gType">The geometric type of the exchange itme (2d or 3d)</param>
        /// <param name="baseOut">The exchange item base output</param>
        /// <param name="elementID">the string id of the exchange item.</param>
        /// <returns></returns>
        private IDictionary <int, ISpatialDefine> GetModelCoordinates3DSZ(GeometryTypes gType, IBaseOutput baseOut, string elementID)
        {
            //Run Only once - because it's slow
            if (_modelEntities == null)
            {
                _modelEntities = new Dictionary <int, ISpatialDefine>();
                int n;

                try
                {
                    WMEngine.GetElementCount(elementID);
                    n = baseOut.ElementSet().ElementCount;
                }
                catch
                {
                    Console.WriteLine("\nElement {0} does not found in the model\n", elementID);
                    throw new Exception("\nProblem in Model Instance - unable to find exchange item\n");
                }

                //int numBaseGrid = Convert.ToInt32(Math.Floor((double)n / (double)_mshe.WMEngine.NumberOfSZLayers));

                for (int i = 0; i < n; i++)
                {
                    XYPolygon modelpolygon = ElementMapper.CreateXYPolygon(baseOut.ElementSet(), i);
                    int       zLayer       = Convert.ToInt32(i % base.WMEngine.NumberOfSZLayers);

                    // Points in Polygon are defined as LL, LR, UR, UL  (l/l = lower/left, u = upper, r = right )
                    // Finds the mid x and mid y point in the polygon (assuming rectangular grid)
                    IXYLayerPoint min = new XYLayerPoint(modelpolygon.GetX(0), modelpolygon.GetY(0), zLayer);
                    IXYLayerPoint max = new XYLayerPoint(modelpolygon.GetX(1), modelpolygon.GetY(3), zLayer);

                    _modelEntities.Add(i, new SpatialDefine(min, max, GeometryTypes.Geometry3DSZ));
                }
            }
            return(_modelEntities);
        }