//--------------------------------------------------------- bool CShapes_Cut_Interactive::Get_Extent(CSG_Rect &r) { CSG_Parameters *pParameters = Get_Parameters("CUT"); pParameters->Get_Parameter("AX")->Set_Value(r.Get_XMin()); pParameters->Get_Parameter("AY")->Set_Value(r.Get_YMin()); pParameters->Get_Parameter("BX")->Set_Value(r.Get_XMax()); pParameters->Get_Parameter("BY")->Set_Value(r.Get_YMax()); pParameters->Get_Parameter("DX")->Set_Value(r.Get_XRange()); pParameters->Get_Parameter("DY")->Set_Value(r.Get_YRange()); if( Dlg_Parameters("CUT") ) { r.Assign( pParameters->Get_Parameter("AX")->asDouble(), pParameters->Get_Parameter("AY")->asDouble(), pParameters->Get_Parameter("BX")->asDouble(), pParameters->Get_Parameter("BY")->asDouble() ); return( true ); } return( false ); }
//--------------------------------------------------------- bool CSTL_Import::Get_Extent(CSG_File &Stream, CSG_Rect &Extent, int nFacettes) { float xMin = 1, xMax = 0, yMin, yMax; for(int iFacette=0; iFacette<nFacettes && !Stream.is_EOF() && Set_Progress(iFacette, nFacettes); iFacette++) { TSTL_Point p[3]; if( Read_Facette(Stream, p) ) { if( iFacette == 0 ) { xMin = xMax = p[0].x; yMin = yMax = p[0].y; } for(int i=0; i<3; i++) { if( xMin > p[i].x ) { xMin = p[i].x; } else if( xMax < p[i].x ) { xMax = p[i].x; } if( yMin > p[i].y ) { yMin = p[i].y; } else if( yMax < p[i].y ) { yMax = p[i].y; } } } } Extent.Assign(xMin, yMin, xMax, yMax); return( xMin < xMax && yMin < yMax && Stream.Seek(80 + sizeof(nFacettes)) ); }
//--------------------------------------------------------- const CSG_Rect & CSG_Shape_Point::Get_Extent(void) { static CSG_Rect Extent; Extent.Assign(m_Point.x, m_Point.y, m_Point.x, m_Point.y); return( Extent ); }
//--------------------------------------------------------- inline void CGeoref_Grid::Add_Target_Extent(CSG_Rect &Extent, double x, double y) { if( m_Engine.Get_Converted(x, y) ) { if( Extent.Get_XRange() >= 0.0 && Extent.Get_YRange() >= 0.0 ) { Extent.Union(CSG_Point(x, y)); } else { Extent.Assign(x, y, x, y); } } }
//--------------------------------------------------------- bool CVIEW_Map_Control::_Zoom(wxPoint A, wxPoint B) { CSG_Rect rWorld; if( A.x == B.x && A.y == B.y ) { return( _Zoom(_Get_World(A), true) ); } rWorld.Assign(_Get_World(A), _Get_World(B)); m_pMap->Set_Extent(rWorld); return( true ); }
//--------------------------------------------------------- bool CVIEW_Map_Control::_Move(wxPoint &A, const wxPoint &B) { if( A.x != B.x || A.y != B.y ) { CSG_Rect rWorld; rWorld.Assign(m_pMap->Get_Extent()); rWorld.Move(_Get_Client2World(A) - _Get_Client2World(B)); m_pMap->Set_Extent(rWorld); A = B; return( true ); } return( false ); }
//--------------------------------------------------------- bool CGCS_Graticule::Get_Extent(const CSG_Rect &Extent, CSG_Rect &r) { if( m_Projector.Set_Inverse() ) { double x, y, d; CSG_Point p(Extent.Get_XMin(), Extent.Get_YMin()); m_Projector.Get_Projection(p); r.Assign(p, p); d = Extent.Get_XRange() / 10.0; for(y=Extent.Get_YMin(), x=Extent.Get_XMin(); x<=Extent.Get_XMax(); x+=d) { p.Assign(x, y); m_Projector.Get_Projection(p); r.Union(p); } for(y=Extent.Get_YMax(), x=Extent.Get_XMin(); x<=Extent.Get_XMax(); x+=d) { p.Assign(x, y); m_Projector.Get_Projection(p); r.Union(p); } d = Extent.Get_YRange() / 10.0; for(x=Extent.Get_XMin(), y=Extent.Get_YMin(); y<=Extent.Get_YMax(); y+=d) { p.Assign(x, y); m_Projector.Get_Projection(p); r.Union(p); } for(x=Extent.Get_XMax(), y=Extent.Get_YMin(); y<=Extent.Get_YMax(); y+=d) { p.Assign(x, y); m_Projector.Get_Projection(p); r.Union(p); } m_Projector.Set_Inverse(false); if( r.Get_XMin() < -180 ) r.m_rect.xMin = -180; else if( r.Get_XMax() > 180 ) r.m_rect.xMax = 180; if( r.Get_YMin() < -90 ) r.m_rect.yMin = -90; else if( r.Get_YMax() > 90 ) r.m_rect.yMax = 90; return( r.Get_XRange() > 0.0 && r.Get_YRange() > 0.0 ); } return( false ); }
//--------------------------------------------------------- bool CShapes_Cut::Get_Extent(CSG_Rect &r) { m_pPolygons = NULL; switch( Parameters("TARGET")->asInt() ) { //----------------------------------------------------- case 0: // user defined Get_Parameters("CUT")->Get_Parameter("AX")->Set_Value(r.Get_XMin()); Get_Parameters("CUT")->Get_Parameter("AY")->Set_Value(r.Get_YMin()); Get_Parameters("CUT")->Get_Parameter("BX")->Set_Value(r.Get_XMax()); Get_Parameters("CUT")->Get_Parameter("BY")->Set_Value(r.Get_YMax()); Get_Parameters("CUT")->Get_Parameter("DX")->Set_Value(r.Get_XRange()); Get_Parameters("CUT")->Get_Parameter("DY")->Set_Value(r.Get_YRange()); if( Dlg_Parameters("CUT") ) { r.Assign( Get_Parameters("CUT")->Get_Parameter("AX")->asDouble(), Get_Parameters("CUT")->Get_Parameter("AY")->asDouble(), Get_Parameters("CUT")->Get_Parameter("BX")->asDouble(), Get_Parameters("CUT")->Get_Parameter("BY")->asDouble() ); return( true ); } break; //----------------------------------------------------- case 1: // grid project if( Dlg_Parameters("GRID") ) { r.Assign(Get_Parameters("GRID")->Get_Parameter("GRID")->asGrid_System()->Get_Extent()); return( true ); } break; //----------------------------------------------------- case 2: // shapes extent if( Dlg_Parameters("SHAPES") ) { r.Assign(Get_Parameters("SHAPES")->Get_Parameter("SHAPES")->asShapes()->Get_Extent()); return( true ); } break; //----------------------------------------------------- case 3: // polygons if( Dlg_Parameters("POLYGONS") ) { r.Assign(Get_Parameters("POLYGONS")->Get_Parameter("POLYGONS")->asShapes()->Get_Extent()); m_pPolygons = Get_Parameters("POLYGONS")->Get_Parameter("POLYGONS")->asShapes(); return( true ); } break; } return( false ); }