//--------------------------------------------------------- bool CVisibility_Point::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode) { int x_Pos, y_Pos; double z_Pos; //----------------------------------------------------- if( Mode != MODULE_INTERACTIVE_LDOWN || !m_pDTM->is_InGrid_byPos(Get_xPosition(), Get_yPosition()) ) { return( false ); } //----------------------------------------------------- x_Pos = Get_xGrid(); y_Pos = Get_yGrid();; z_Pos = m_pDTM->asDouble(x_Pos, y_Pos) + m_Height; if( !m_bMultiple ) Initialize(m_pVisibility, m_Method); Set_Visibility(m_pDTM, m_pVisibility, x_Pos, y_Pos, z_Pos, m_Height, m_Method); //----------------------------------------------------- Finalize(m_pVisibility, m_Method); return( true ); }
//--------------------------------------------------------- bool CSG_Module_Grid_Interactive::Get_Grid_Pos(int &x, int &y) { bool bResult; if( Get_System()->is_Valid() ) { bResult = true; //------------------------------------------------- x = (int)(0.5 + (Get_xPosition() - Get_System()->Get_XMin()) / Get_System()->Get_Cellsize()); if( x < 0 ) { bResult = false; x = 0; } else if( x >= Get_System()->Get_NX() ) { bResult = false; x = Get_System()->Get_NX() - 1; } //------------------------------------------------- y = (int)(0.5 + (Get_yPosition() - Get_System()->Get_YMin()) / Get_System()->Get_Cellsize()); if( y < 0 ) { bResult = false; y = 0; } else if( y >= Get_System()->Get_NY() ) { bResult = false; y = Get_System()->Get_NY() - 1; } return( bResult ); } //----------------------------------------------------- x = 0; y = 0; return( false ); }
//--------------------------------------------------------- bool CMine_Sweeper::Get_Grid_Pos(int &x, int &y) { bool bResult; if( pInput && pInput->is_Valid() ) { bResult = true; //------------------------------------------------- x = (int)(0.5 + (Get_xPosition() - pInput->Get_XMin()) / pInput->Get_Cellsize()); if( x < 0 ) { bResult = false; x = 0; } else if( x >= pInput->Get_NX() ) { bResult = false; x = pInput->Get_NX() - 1; } //------------------------------------------------- y = (int)(0.5 + (Get_yPosition() - pInput->Get_YMin()) / pInput->Get_Cellsize()); if( y < 0 ) { bResult = false; y = 0; } else if( y >= pInput->Get_NY() ) { bResult = false; y = pInput->Get_NY() - 1; } return( bResult ); } //----------------------------------------------------- x = 0; y = 0; return( false ); }
//--------------------------------------------------------- int CSG_Module_Grid_Interactive::Get_xGrid(void) { int x; if( Get_System()->is_Valid() ) { x = (int)(0.5 + (Get_xPosition() - Get_System()->Get_XMin()) / Get_System()->Get_Cellsize()); if( x < 0 ) { x = 0; } else if( x >= Get_System()->Get_NX() ) { x = Get_System()->Get_NX() - 1; } return( x ); } return( 0 ); }