//---------------------------------------------------------
bool CSelect_Points::On_Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode)
{
	switch( Mode )
	{
	case TOOL_INTERACTIVE_LUP:
		m_pSelection->Del_Records();

		if( m_bAddCenter )
		{
			m_pSelection->Add_Shape()->Add_Point(ptWorld);
		}

		if( m_Search.Select_Nearest_Points(ptWorld.Get_X(), ptWorld.Get_Y(), m_MaxPoints, m_Radius, m_Quadrant) )
		{
			for(int i=0; i<m_Search.Get_Selected_Count(); i++)
			{
				CSG_Shape	*pPoint	= m_pSelection->Add_Shape(m_pPoints->Get_Shape((int)m_Search.Get_Selected_Z(i)));

				pPoint->Set_Value(m_pSelection->Get_Field_Count() - 2, i + 1);
				pPoint->Set_Value(m_pSelection->Get_Field_Count() - 1, m_Search.Get_Selected_Distance(i));
			}
		}

		DataObject_Update(m_pSelection);

		break;

	default:
		break;
	}

	return( true );
}
//---------------------------------------------------------
int CWKSP_Shapes::Edit_Shape_HitTest(CSG_Point pos_Point, double max_Dist, int &pos_iPart, int &pos_iPoint)
{
	int			Result, iPart, iPoint;
	double		d, dx, dy;
	TSG_Point	Point;

	Result		= 0;

	pos_iPoint	= -1;
	pos_iPart	= -1;

	if( m_Edit_pShape )
	{
		for(iPart=0; iPart<m_Edit_pShape->Get_Part_Count(); iPart++)
		{
			for(iPoint=0; iPoint<m_Edit_pShape->Get_Point_Count(iPart); iPoint++)
			{
				Point	= m_Edit_pShape->Get_Point(iPoint, iPart);
				dx		= pos_Point.Get_X() - Point.x;
				dy		= pos_Point.Get_Y() - Point.y;
				d		= sqrt(dx*dx + dy*dy);

				if( 0.0 > max_Dist || d < max_Dist )
				{
					Result		= 1;
					max_Dist	= d;
					pos_iPoint	= iPoint;
					pos_iPart	= iPart;
				}
			}
		}
	}

	return( Result );
}
//---------------------------------------------------------
TSG_Intersection CSG_Shape_Points::On_Intersects(CSG_Shape *pShape)
{
	CSG_Shape	*piPoints, *pjPoints;

	if( CSG_Shape::Get_Point_Count() < pShape->Get_Point_Count() )
	{
		piPoints	= this;
		pjPoints	= pShape;
	}
	else
	{
		piPoints	= pShape;
		pjPoints	= this;
	}

	bool	bIn		= false;
	bool	bOut	= false;

	for(int iPart=0; iPart<piPoints->Get_Part_Count(); iPart++)
	{
		for(int iPoint=0; iPoint<piPoints->Get_Point_Count(iPart); iPoint++)
		{
			CSG_Point	Point	= piPoints->Get_Point(iPoint, iPart);

			for(int jPart=0; jPart<pjPoints->Get_Part_Count(); jPart++)
			{
				for(int jPoint=0; jPoint<pjPoints->Get_Point_Count(jPart); jPoint++)
				{
					if( Point.is_Equal(pjPoints->Get_Point(jPoint, jPart)) )
					{
						bIn		= true;
					}
					else
					{
						bOut	= true;
					}

					if( bIn && bOut )
					{
						return( INTERSECTION_Overlaps );
					}
				}
			}
		}
	}

	if( bIn )
	{
		return( piPoints == this ? INTERSECTION_Contained : INTERSECTION_Contains );
	}

	return( INTERSECTION_None );
}
Exemple #4
0
//---------------------------------------------------------
bool CGrid_Profile::Add_Point(CSG_Point Point)
{
	int			x, y, i;
	double		z, Distance, Distance_2;
	CSG_Shape	*pPoint, *pLast;

	if( Get_System()->Get_World_to_Grid(x, y, Point) && m_pDEM->is_InGrid(x, y) )
	{
		z	= m_pDEM->asDouble(x, y);

		if( m_pPoints->Get_Count() == 0 )
		{
			Distance	= 0.0;
			Distance_2	= 0.0;
		}
		else
		{
			pLast		= m_pPoints->Get_Shape(m_pPoints->Get_Count() - 1);
			Distance	= SG_Get_Distance(Point, pLast->Get_Point(0));

			if( Distance == 0.0 )
			{
				return( false );
			}

			Distance_2	= pLast->asDouble(5) - z;
			Distance_2	= sqrt(Distance*Distance + Distance_2*Distance_2);

			Distance	+= pLast->asDouble(1);
			Distance_2	+= pLast->asDouble(2);
		}

		pPoint	= m_pPoints->Add_Shape();
		pPoint->Add_Point(Point);

		pPoint->Set_Value(0, m_pPoints->Get_Count());
		pPoint->Set_Value(1, Distance);
		pPoint->Set_Value(2, Distance_2);
		pPoint->Set_Value(3, Point.Get_X());
		pPoint->Set_Value(4, Point.Get_Y());
		pPoint->Set_Value(5, z);

		for(i=0; i<m_pValues->Get_Count(); i++)
		{
			pPoint->Set_Value(VALUE_OFFSET + i, m_pValues->asGrid(i)->asDouble(x, y, true));
		}

		return( true );
	}

	return( false );
}
//---------------------------------------------------------
bool CSG_CRSProjector::Get_Projection(CSG_Point &Point)	const
{
	double	x	= Point.Get_X();
	double	y	= Point.Get_Y();

	if( Get_Projection(x, y) )
	{
		Point.Assign(x, y);

		return( true );
	}

	return( false );
}
//---------------------------------------------------------
bool CCollect_Points::On_Execute_Position(CSG_Point ptWorld, TSG_Module_Interactive_Mode Mode)
{
	if( Mode == MODULE_INTERACTIVE_LUP )
	{
		TSG_Point	ptTarget;

		if( m_Engine.Get_Converted(ptTarget = ptWorld) )
		{
			Get_Parameters("REFERENCE")->Get_Parameter("X")->Set_Value(ptTarget.x);
			Get_Parameters("REFERENCE")->Get_Parameter("Y")->Set_Value(ptTarget.y);
		}

		if( Dlg_Parameters("REFERENCE") )
		{
			int	Method	= Parameters("METHOD")->asInt();
			int	Order	= Parameters("ORDER" )->asInt();

			CSG_Shape	*pPoint	= m_pPoints->Add_Shape();

			pPoint->Add_Point(ptWorld);
			pPoint->Set_Value(0, ptWorld.Get_X());
			pPoint->Set_Value(1, ptWorld.Get_Y());
			pPoint->Set_Value(2, ptTarget.x = Get_Parameters("REFERENCE")->Get_Parameter("X")->asDouble());
			pPoint->Set_Value(3, ptTarget.y = Get_Parameters("REFERENCE")->Get_Parameter("Y")->asDouble());

			if( m_Engine.Add_Reference(ptWorld, ptTarget) && m_Engine.Evaluate(Method, Order) && m_pPoints->Get_Count() == m_Engine.Get_Reference_Count() )
			{
				for(int i=0; i<m_pPoints->Get_Count(); i++)
				{
					m_pPoints->Get_Shape(i)->Set_Value(4, m_Engine.Get_Reference_Residual(i));
				}
			}

			DataObject_Update(m_pPoints);
		}
	}

	return( true );
}
//---------------------------------------------------------
void CWKSP_Shapes::_Edit_Snap_Point(CSG_Point pos_Point, CSG_Point &snap_Point, double &snap_Dist, CSG_Shape *pShape)
{
	int			iPart, iPoint;
	double		d, dx, dy;
	TSG_Point	Point;

	for(iPart=0; iPart<pShape->Get_Part_Count(); iPart++)
	{
		for(iPoint=0; iPoint<pShape->Get_Point_Count(iPart); iPoint++)
		{
			Point	= pShape->Get_Point(iPoint, iPart);
			dx		= pos_Point.Get_X() - Point.x;
			dy		= pos_Point.Get_Y() - Point.y;
			d		= sqrt(dx*dx + dy*dy);

			if( d < snap_Dist )
			{
				snap_Dist	= d;
				snap_Point	= Point;
			}
		}
	}
}
//---------------------------------------------------------
void CWKSP_Shapes::_Edit_Snap_Point(CSG_Point Point, CSG_Point &snap_Point, double &snap_Dist, CSG_Shapes *pShapes, bool bLine)
{
	CSG_Shape	*pSelected	= pShapes->Get_Selection(m_Edit_Index);

	if( pShapes->Select(CSG_Rect(Point.Get_X() - snap_Dist, Point.Get_Y() - snap_Dist, Point.Get_X() + snap_Dist, Point.Get_Y() + snap_Dist)) )
	{
		for(int i=0; i<pShapes->Get_Selection_Count(); i++)
		{
			if( pShapes != Get_Shapes() || pSelected != pShapes->Get_Selection(i) )
			{
				if( bLine )
				{
					Edit_Snap_Point_ToLine(Point, snap_Point, snap_Dist, pShapes->Get_Selection(i));
				}
				else
				{
					_Edit_Snap_Point      (Point, snap_Point, snap_Dist, pShapes->Get_Selection(i));
				}
			}
		}
	}

	pShapes->Select(pSelected);
}
//---------------------------------------------------------
void CSG_Rect::Union(const CSG_Point &Point)
{
	if( m_rect.xMin > Point.Get_X() )
	{
		m_rect.xMin	= Point.Get_X();
	}
	else if( m_rect.xMax < Point.Get_X() )
	{
		m_rect.xMax	= Point.Get_X();
	}

	if( m_rect.yMin > Point.Get_Y() )
	{
		m_rect.yMin	= Point.Get_Y();
	}
	else if( m_rect.yMax < Point.Get_Y() )
	{
		m_rect.yMax	= Point.Get_Y();
	}
}
Exemple #10
0
void CSG_Rect::operator += (const CSG_Point &Point)
{
	Move( Point.Get_X(),  Point.Get_Y());
}
Exemple #11
0
//---------------------------------------------------------
bool CLakeFloodInteractive::On_Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode)
{
	//-----------------------------------------------------
	if(  Mode == TOOL_INTERACTIVE_LDOWN )
	{
		int			x, y, ix, iy, i;
		double		level;
	
		x	= Get_System()->Get_xWorld_to_Grid(ptWorld.Get_X());
		y	= Get_System()->Get_yWorld_to_Grid(ptWorld.Get_Y());
	
		if( pElev->is_InGrid(x, y, true) )
		{
			if( !m_bLevel )
				level = m_water + pElev->asDouble(x, y);
			else
				level = m_water;


			if( level <= pOlevel->asDouble(x, y) )
				return (true);


			newCell		= new CTraceOrder();
			newCell->x	= x;
			newCell->y	= y;
			firstCell	= newCell;

			pOdepth->Set_Value(x, y, level - pElev->asDouble(x, y));
			pOlevel->Set_Value(x, y, level);


			iterCell = firstCell;
			lastCell = firstCell;

			while( iterCell != NULL ) 
			{
				x	= iterCell->x;
				y	= iterCell->y;

				for( i=0; i<8; i++ )												
				{
					ix	= Get_xTo(i, x);			
					iy	= Get_yTo(i, y);			
								
					if(	is_InGrid(ix, iy) && !pElev->is_NoData(ix, iy) && pOlevel->asDouble(ix, iy) < level )
					{ 
						pOdepth->Set_Value(ix, iy, level - pElev->asDouble(ix, iy));
						pOlevel->Set_Value(ix, iy, level);
						newCell = new CTraceOrder();
						newCell->x = ix;
						newCell->y = iy;
						newCell->prev = lastCell;
						lastCell->next = newCell;
						lastCell = newCell;
					}
				}
			
				newCell = firstCell;

				if( newCell->next == NULL )
				{
					firstCell = lastCell = NULL;
					delete (newCell);
					newCell = NULL;
				}
				else
				{
					newCell->next->prev = NULL;
					firstCell = newCell->next;
					newCell->next = NULL;
					delete (newCell);
					newCell = NULL;
				}

				iterCell = firstCell;
			}

			SG_UI_Msg_Add(_TL("ready ..."), true);
			DataObject_Update(pOdepth, pOdepth->Get_ZMin(), pOdepth->Get_ZMax());
			DataObject_Update(pOlevel, pOlevel->Get_ZMin(), pOlevel->Get_ZMax());
			return( true );
		}
	}

	return( false );
}
Exemple #12
0
//---------------------------------------------------------
inline void CVIEW_Map_Control::_Set_StatusBar(CSG_Point ptWorld)
{
	static bool	bBuisy	= false;

	if( bBuisy == false )
	{
		bBuisy	= true;

		CSG_Tool	*pProjector	= NULL;

		if( m_pMap->Get_Parameter("GCS_POSITION")->asBool() && m_pMap->Get_Projection().is_Okay() && (pProjector = SG_Get_Tool_Library_Manager().Get_Tool("pj_proj4", 2)) != NULL )	// Coordinate Transformation (Shapes)
		{
			if( pProjector->is_Executing() )
			{
				pProjector	= NULL;
			}
			else
			{
				SG_UI_Progress_Lock(true);
				SG_UI_Msg_Lock     (true);

				CSG_Shapes	prj(SHAPE_TYPE_Point), gcs(SHAPE_TYPE_Point); prj.Add_Shape()->Add_Point(ptWorld); prj.Get_Projection().Assign(m_pMap->Get_Projection());

				pProjector->Settings_Push(NULL);

				if( pProjector->Set_Parameter("CRS_PROJ4", SG_T("+proj=longlat +ellps=WGS84 +datum=WGS84"))
				&&  pProjector->Set_Parameter("SOURCE"   , &prj)
				&&  pProjector->Set_Parameter("TARGET"   , &gcs)
				&&  pProjector->Execute() )
				{
					CSG_Point ptWorld_gcs	= gcs.Get_Shape(0)->Get_Point(0);

					STATUSBAR_Set_Text(wxString::Format("X %s", SG_Double_To_Degree(ptWorld_gcs.Get_X()).c_str()), STATUSBAR_VIEW_X);
					STATUSBAR_Set_Text(wxString::Format("Y %s", SG_Double_To_Degree(ptWorld_gcs.Get_Y()).c_str()), STATUSBAR_VIEW_Y);

					pProjector->Settings_Pop();
				}
				else
				{
					pProjector->Settings_Pop();		pProjector	= NULL;
				}

				SG_UI_Progress_Lock(false);
				SG_UI_Msg_Lock     (false);
			}
		}

		if( !pProjector )
		{
			STATUSBAR_Set_Text(wxString::Format("X %f", ptWorld.Get_X()), STATUSBAR_VIEW_X);
			STATUSBAR_Set_Text(wxString::Format("Y %f", ptWorld.Get_Y()), STATUSBAR_VIEW_Y);
		}

		if( m_Mode == MAP_MODE_DISTANCE )
		{
			STATUSBAR_Set_Text(wxString::Format("D %f", m_Distance + m_Distance_Move), STATUSBAR_VIEW_Z);
		}
		else if( Get_Active_Layer() )
		{
			STATUSBAR_Set_Text(wxString::Format("Z %s", Get_Active_Layer()->Get_Value(ptWorld, _Get_World(2.0)).c_str()), STATUSBAR_VIEW_Z);
		}
		else
		{
			STATUSBAR_Set_Text("Z", STATUSBAR_VIEW_Z);
		}

		bBuisy	= false;
	}
}
Exemple #13
0
bool CSG_Rect::Contains(const CSG_Point &Point) const
{
	return( Contains(Point.Get_X(), Point.Get_Y()) );
}
Exemple #14
0
void CSG_Rect::Move(const CSG_Point &Point)
{
	Move(Point.Get_X(), Point.Get_Y());
}
Exemple #15
0
void CSG_Rect::Set_TopRight(const CSG_Point &Point)
{
	Set_TopRight(Point.Get_X(), Point.Get_Y() );
}
Exemple #16
0
void CSG_Rect::Set_BottomLeft(const CSG_Point &Point)
{
	Set_BottomLeft(Point.Get_X(), Point.Get_Y() );
}
Exemple #17
0
void CSG_Rect::Assign(const CSG_Point &A, const CSG_Point &B)
{
	Assign(A.Get_X(), A.Get_Y(), B.Get_X(), B.Get_Y());
}
//---------------------------------------------------------
bool CPolygon_Shared_Edges::Get_Shared_Edges(CSG_Shape_Part *pA, CSG_Shape_Part *pB, double Epsilon)
{
	int	Edge_1st	= m_pEdges->Get_Count();

	CSG_Shape	*pEdge	= NULL;

	for(int iPoint=0, jPoint; iPoint<pA->Get_Count(); iPoint++)
	{
		CSG_Point	Point	= pA->Get_Point(iPoint);

		if( !pEdge )
		{
			for(jPoint=0; jPoint<pB->Get_Count(); jPoint++)
			{
				if( Point.is_Equal(pB->Get_Point(jPoint), Epsilon) )
				{
					pEdge	= m_pEdges->Add_Shape();
					pEdge	->Add_Point(Point);

					if( m_Field < 0 )
					{
						pEdge->Set_Value(0, pA->Get_Owner()->Get_Index());
						pEdge->Set_Value(1, pB->Get_Owner()->Get_Index());
					}
					else
					{
						pEdge->Set_Value(0, pA->Get_Owner()->asString(m_Field));
						pEdge->Set_Value(1, pB->Get_Owner()->asString(m_Field));
					}
					break;
				}
			}
		}
		else
		{
			int	j	= jPoint;

			if( Point.is_Equal(pB->Get_Point(jPoint = Get_Next_Vertex(pB, j, false)), Epsilon)
			||  Point.is_Equal(pB->Get_Point(jPoint = Get_Next_Vertex(pB, j, true )), Epsilon) )
			{
				pEdge->Add_Point(Point);
			}
			else
			{
				pEdge	= NULL;
			}
		}
	}

	//-----------------------------------------------------
	if( pEdge )
	{
		CSG_Shape	*pEdge_1st	= m_pEdges->Get_Shape(Edge_1st);

		if( pEdge != pEdge_1st && SG_Is_Equal(pA->Get_Point(0), pEdge_1st->Get_Point(0)) )
		{
			for(int i=0; i<pEdge_1st->Get_Point_Count(0); i++)
			{
				pEdge->Add_Point(pEdge_1st->Get_Point(i));
			}

			m_pEdges->Del_Shape(Edge_1st);
		}
	}

	//-----------------------------------------------------
	for(int iEdge=m_pEdges->Get_Count()-1; iEdge>=Edge_1st; iEdge--)
	{
		if( m_pEdges->Get_Shape(iEdge)->Get_Point_Count() <= 1 )	// touches at point
		{
			m_pEdges->Del_Shape(iEdge);
		}
	}

	//-----------------------------------------------------
	return( true );
}
Exemple #19
0
//---------------------------------------------------------
bool CSG_Network::Remove_End_Nodes(void)
{
	int		iEdge, n;

	//-----------------------------------------------------
	for(iEdge=0; iEdge<m_Edges.Get_Count(); iEdge++)
	{
		CSG_Shape	*pEdge	= m_Edges.Get_Shape(iEdge);

		if( pEdge->asInt(3) == SHAPE_TYPE_Line )
		{
			bool	bRemove	= false;

			for(int iNode=1; iNode<=2 && !bRemove; iNode++)
			{
				CSG_Network_Node	&Node	= Get_Node(pEdge->asInt(iNode));
				CSG_Point			Point	= Node.Get_Point();
				CSG_Shape			*pNext;

				if(	(	(pNext = m_Edges.Get_Shape(Node.Get_Edge_Next(pEdge->asInt(0),  true))) != NULL
						&&	pNext->asInt(3) == SHAPE_TYPE_Polygon
						&&	!Point.is_Equal(pNext->Get_Point(0, 0, false)) )
				||	(	(pNext = m_Edges.Get_Shape(Node.Get_Edge_Next(pEdge->asInt(0), false))) != NULL
						&&	pNext->asInt(3) == SHAPE_TYPE_Polygon
						&&	!Point.is_Equal(pNext->Get_Point(0, 0,  true)) ) )
				{
					bRemove	= true;
				}
			}

			if( bRemove )
			{
				Get_Node(pEdge->asInt(1)).Del_Edge(pEdge->asInt(0));
				Get_Node(pEdge->asInt(2)).Del_Edge(pEdge->asInt(0));

				pEdge->Set_Value(4, 1);
			}
		}
	}

	//-----------------------------------------------------
	do
	{
		for(n=0, iEdge=0; iEdge<m_Edges.Get_Count(); iEdge++)
		{
			CSG_Shape	*pEdge	= m_Edges.Get_Shape(iEdge);

			if( pEdge->asInt(3) == SHAPE_TYPE_Line && pEdge->asInt(4) == 0 )
			{
				if(	Get_Node(pEdge->asInt(1)).Get_Edge_Count() <= 1
				||	Get_Node(pEdge->asInt(2)).Get_Edge_Count() <= 1 )
				{
					Get_Node(pEdge->asInt(1)).Del_Edge(pEdge->asInt(0));
					Get_Node(pEdge->asInt(2)).Del_Edge(pEdge->asInt(0));

					pEdge->Set_Value(4, 1);

					n++;
				}
			}
		}
	}
	while( n > 0 );

	//-----------------------------------------------------
	for(iEdge=m_Edges.Get_Count()-1; iEdge>=0; iEdge--)
	{
		if( m_Edges[iEdge][4] )
		{
			m_Edges.Del_Shape(iEdge);
		}
	}

	//-----------------------------------------------------
	return( Update() );
}
Exemple #20
0
void CSG_Point::Subtract(const CSG_Point &Point)
{
	m_x	-= Point.Get_X();
	m_y	-= Point.Get_Y();
}
Exemple #21
0
//---------------------------------------------------------
bool CGrid_Fill::On_Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode)
{
	//-----------------------------------------------------
	if(  Mode == TOOL_INTERACTIVE_LDOWN )
	{
		int		x, y, i, ix, iy, nReplaced;
		double	z, zMin, zMax;

		x	= Get_System()->Get_xWorld_to_Grid(ptWorld.Get_X());
		y	= Get_System()->Get_yWorld_to_Grid(ptWorld.Get_Y());

		if( m_pGrid && m_pGrid->is_InGrid(x, y, m_bNoData) )
		{
			Message_Add(_TL("Starting flood fill..."));

			switch( m_Method )
			{
			case 0:	z	= m_pGrid->asDouble(x, y);	break;	// value at mouse position
			case 1:	z	= m_zFixed;					break;	// fixed value
			case 2:	z	= 0.0;						break;	// tolerance as absolute values
			}

			zMin		= z + m_zTolerance_Min;
			zMax		= z + m_zTolerance_Max;

			m_iStack	= 0;
			nReplaced	= 1;

			Push(x, y);

			//---------------------------------------------
			while( m_iStack > 0 && Set_Progress_NCells(nReplaced) )
			{
				Pop(x, y);

				for(i=0; i<8; i+=2)
				{
					ix	= Get_xTo(i, x);
					iy	= Get_yTo(i, y);

					if(	m_pGrid->is_InGrid(ix, iy, m_bNoData) )
					{
						z	= m_pGrid->asDouble(ix, iy);

						if( z != m_zFill && z >= zMin && z <= zMax )
						{
							Push(ix, iy);

							m_pGrid->Set_Value(ix, iy, m_zFill);

							nReplaced++;
						}
					}
				}
			}

			//---------------------------------------------
			Message_Add(_TL("ready"), false);
			Message_Add(CSG_String::Format(SG_T("%d %s"), nReplaced, _TL("replacements")));

			DataObject_Update(m_pGrid, m_pGrid->Get_ZMin(), m_pGrid->Get_ZMax());

			return( true );
		}
	}

	return( false );
}
//---------------------------------------------------------
bool CWKSP_Shapes::_Edit_Move(bool bToggle)
{
	if( m_Edit_pShape )
	{
		if( bToggle )
		{
			switch( m_Edit_Mode )
			{
			default:
				break;

			//---------------------------------------------
			case EDIT_SHAPE_MODE_Normal:
				m_Edit_Mode	= EDIT_SHAPE_MODE_Move;

				if( m_Edit_Shapes.Get_Count() > 1 )
				{
					m_Edit_Shapes.Get_Shape(1)->Del_Parts();
				}
				else
				{
					m_Edit_Shapes.Add_Shape();
				}

				return( true );

			//---------------------------------------------
			case EDIT_SHAPE_MODE_Move:
				m_Edit_Mode	= EDIT_SHAPE_MODE_Normal;

				m_Edit_Shapes.Del_Shape(1);

				return( true );
			}
		}

		//-------------------------------------------------
		else // if( !bToggle )
		{
			if( m_Edit_Shapes.Get_Count() > 1 && m_Edit_Shapes.Get_Shape(1)->Get_Point_Count() > 1 )
			{
				CSG_Point	Move	= CSG_Point(m_Edit_Shapes.Get_Shape(1)->Get_Point(1))
									- CSG_Point(m_Edit_Shapes.Get_Shape(1)->Get_Point(0));

				m_Edit_Shapes.Get_Shape(1)->Del_Parts();

				if( SG_Get_Length(Move.Get_X(), Move.Get_Y()) > 0.0 )
				{
					for(int iPart=0; iPart<m_Edit_pShape->Get_Part_Count(); iPart++)
					{
						for(int iPoint=0; iPoint<m_Edit_pShape->Get_Point_Count(iPart); iPoint++)
						{
							m_Edit_pShape->Set_Point(Move + m_Edit_pShape->Get_Point(iPoint, iPart), iPoint, iPart);
						}
					}

					Update_Views(false);

					return( true );
				}
			}
		}
	}

	return( false );
}
Exemple #23
0
void CSG_Rect::operator -= (const CSG_Point &Point)
{
	Move(-Point.Get_Y(), -Point.Get_Y());
}