Пример #1
0
        private IEnumerable <GeoModel> createBlock(GeoBlock block)
        {
            float ox, oy, oz;

            if (block.getType() == GEO.GEO_BLOCK_TYPE_FLAT)
            {
                GeoCell cell = block.nGetCell(0, 0, 0);
                //
                float xx = GEO.getWorldX(cell.getGeoX());
                float yy = GEO.getWorldY(cell.getGeoY());
                float zz = GEO.getHeight(cell.getHeight());
                yield return(appendModel(xx, zz, yy, true));
            }
            else if (block.getType() == GEO.GEO_BLOCK_TYPE_COMPLEX)
            {
                GeoModel  m;
                GeoCell   cell;
                GeoCell[] cells = block.getCells();
                int       c     = cells.Length;
                for (int i = 0; i < c; i++)
                {
                    cell = cells[i];
                    ox   = GEO.getWorldX(cell.getGeoX());
                    oz   = GEO.getWorldY(cell.getGeoY());
                    oy   = GEO.getHeight(cell.getHeight());
                    m    = appendModel(ox, oy, oz, false);
                    updateMask(m, cell);
                    yield return(m);
                }
            }
            else if (block.getType() == GEO.GEO_BLOCK_TYPE_MULTILAYER)
            {
                int c = block.getMaxLayerCount();
                //
                GeoModel m;
                int      x, y;
                int      min_x = block.getGeoX();
                int      max_x = block.getMaxGeoX();
                int      min_y = block.getGeoY();
                int      max_y = block.getMaxGeoY();
                for (y = min_y; y <= max_y; y++)
                {
                    for (x = min_x; x <= max_x; x++)
                    {
                        GeoCell[] cells = block.nGetLayers(x, y);
                        foreach (GeoCell cell in cells)
                        {
                            ox = GEO.getWorldX(cell.getGeoX());
                            oz = GEO.getWorldY(cell.getGeoY());
                            oy = GEO.getHeight(cell.getHeight());
                            m  = appendModel(ox, oy, oz, false);
                            updateMask(m, cell);
                            yield return(m);
                        }
                    }
                }
            }
        }
            protected override void Process()
            {
                Engine geo = Engine.getInstance();

                geo.unload();
                geo.reloadGeo(X, Y, false);
                //
                GeoRegion region = geo.getActiveRegion();

                Scene.LoadRegion(region, progress_event);
                //
                List <DomainData> domains = getDomains();

                Scene.SetDomains(domains);
            }
 public PositionControl()
 {
     InitializeComponent();
     //
     if (!DesignerProperties.GetIsInDesignMode(this))
     {
         map.Visibility = Visibility.Collapsed;
         //
         gridBase.Children.Add(dx = new GraphicsDeviceControl());
         dx.SetValue(Grid.RowProperty, 1);
         dx.SetValue(Grid.ColumnProperty, 1);
         dx.LoadContent     += dx_LoadContent;
         dx.RenderXna       += dx_RenderXna;
         dx.WindowCreated   += dx_WindowCreated;
         dx.HwndLButtonDown += dx_HwndLButtonDown;
         dx.HwndLButtonUp   += dx_HwndLButtonUp;
         dx.HwndRButtonDown += dx_HwndRButtonDown;
         dx.HwndRButtonUp   += dx_HwndRButtonUp;
         dx.HwndMouseMove   += dx_HwndMouseMove;
         dx.Visibility       = Visibility.Collapsed;
         //
         region_x = 12;
         region_y = 12;
         //
         try {
             Engine.init();
             GeoBlockSelector.init();
         }
         catch (Exception error) {
             Console.WriteLine("Failed to initialize GeoEngine! " + error.Message);
         }
         //
         try { scene = new TestScene(); }
         catch (Exception error) {
             Console.WriteLine("Failed to initialize Scene! " + error.Message);
         }
     }
 }
Пример #4
0
        //-----------------------------

        public static void init()
        {
            _instance = new GeoEngine();
        }
Пример #5
0
 public override string ToString()
 {
     return(getStringType(getType()) + " " + GeoEngine.getBlockXY(_geoX) + ", " + GeoEngine.getBlockXY(_geoY));
 }
Пример #6
0
 public int getBlockY()
 {
     return(GeoEngine.getBlockXY(_geoY));
 }