int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent ) { BOARD* board = getModel<BOARD>(); RN_DATA* ratsnest = board->GetRatsnest(); BOARD_COMMIT commit( this ); for( int i = 0; i < board->GetAreaCount(); ++i ) { ZONE_CONTAINER* zone = board->GetArea( i ); commit.Modify( zone ); zone->SetIsFilled( false ); zone->ClearFilledPolysList(); ratsnest->Update( zone ); getView()->Update( zone ); } commit.Push( _( "Unfill All Zones" ) ); ratsnest->Recalculate(); return 0; }
int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent ) { auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>(); const auto& selection = selTool->GetSelection(); RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest(); BOARD_COMMIT commit( this ); for( auto item : selection ) { assert( item->Type() == PCB_ZONE_AREA_T ); ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item ); commit.Modify( zone ); zone->SetIsFilled( false ); zone->ClearFilledPolysList(); ratsnest->Update( zone ); getView()->Update( zone ); } commit.Push( _( "Unfill Zone" ) ); ratsnest->Recalculate(); return 0; }
int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent ) { BOARD* board = getModel<BOARD>(); for( int i = 0; i < board->GetAreaCount(); ++i ) { ZONE_CONTAINER* zone = board->GetArea( i ); zone->SetIsFilled( false ); zone->ClearFilledPolysList(); zone->ViewUpdate(); } setTransitions(); return 0; }
int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent ) { BOARD* board = getModel<BOARD>(); RN_DATA* ratsnest = board->GetRatsnest(); for( int i = 0; i < board->GetAreaCount(); ++i ) { ZONE_CONTAINER* zone = board->GetArea( i ); zone->SetIsFilled( false ); zone->ClearFilledPolysList(); ratsnest->Update( zone ); zone->ViewUpdate(); } ratsnest->Recalculate(); return 0; }
int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent ) { SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>(); const SELECTION& selection = selTool->GetSelection(); for( int i = 0; i < selection.Size(); ++i ) { assert( selection.Item<BOARD_ITEM>( i )->Type() == PCB_ZONE_AREA_T ); ZONE_CONTAINER* zone = selection.Item<ZONE_CONTAINER>( i ); zone->SetIsFilled( false ); zone->ClearFilledPolysList(); zone->ViewUpdate(); } setTransitions(); return 0; }
int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent ) { SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>(); const SELECTION& selection = selTool->GetSelection(); RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest(); for( int i = 0; i < selection.Size(); ++i ) { assert( selection.Item<BOARD_ITEM>( i )->Type() == PCB_ZONE_AREA_T ); ZONE_CONTAINER* zone = selection.Item<ZONE_CONTAINER>( i ); zone->SetIsFilled( false ); zone->ClearFilledPolysList(); ratsnest->Update( zone ); zone->ViewUpdate(); } ratsnest->Recalculate(); return 0; }
void POINT_EDITOR::updateItem() const { EDA_ITEM* item = m_editPoints->GetParent(); switch( item->Type() ) { case PCB_LINE_T: case PCB_MODULE_EDGE_T: { DRAWSEGMENT* segment = static_cast<DRAWSEGMENT*>( item ); switch( segment->GetShape() ) { case S_SEGMENT: if( isModified( m_editPoints->Point( SEG_START ) ) ) segment->SetStart( wxPoint( m_editPoints->Point( SEG_START ).GetPosition().x, m_editPoints->Point( SEG_START ).GetPosition().y ) ); else if( isModified( m_editPoints->Point( SEG_END ) ) ) segment->SetEnd( wxPoint( m_editPoints->Point( SEG_END ).GetPosition().x, m_editPoints->Point( SEG_END ).GetPosition().y ) ); break; case S_ARC: { const VECTOR2I& center = m_editPoints->Point( ARC_CENTER ).GetPosition(); const VECTOR2I& start = m_editPoints->Point( ARC_START ).GetPosition(); const VECTOR2I& end = m_editPoints->Point( ARC_END ).GetPosition(); if( center != segment->GetCenter() ) { wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter(); segment->Move( moveVector ); m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() ); m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() ); } else { segment->SetArcStart( wxPoint( start.x, start.y ) ); VECTOR2D startLine = start - center; VECTOR2I endLine = end - center; double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() ); // Adjust the new angle to (counter)clockwise setting bool clockwise = ( segment->GetAngle() > 0 ); if( clockwise && newAngle < 0.0 ) newAngle += 3600.0; else if( !clockwise && newAngle > 0.0 ) newAngle -= 3600.0; segment->SetAngle( newAngle ); } break; } case S_CIRCLE: { const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition(); const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition(); if( isModified( m_editPoints->Point( CIRC_CENTER ) ) ) { wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter(); segment->Move( moveVector ); } else { segment->SetEnd( wxPoint( end.x, end.y ) ); } break; } default: // suppress warnings break; } // Update relative coordinates for module edges if( EDGE_MODULE* edge = dyn_cast<EDGE_MODULE*>( item ) ) edge->SetLocalCoord(); break; } case PCB_ZONE_AREA_T: { ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item ); zone->ClearFilledPolysList(); CPolyLine* outline = zone->Outline(); for( int i = 0; i < outline->GetCornersCount(); ++i ) { VECTOR2I point = m_editPoints->Point( i ).GetPosition(); outline->SetX( i, point.x ); outline->SetY( i, point.y ); } break; } case PCB_DIMENSION_T: { DIMENSION* dimension = static_cast<DIMENSION*>( item ); // Check which point is currently modified and updated dimension's points respectively if( isModified( m_editPoints->Point( DIM_CROSSBARO ) ) ) { VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetOrigin() ); VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() ); if( featureLine.Cross( crossBar ) > 0 ) dimension->SetHeight( -featureLine.EuclideanNorm() ); else dimension->SetHeight( featureLine.EuclideanNorm() ); } else if( isModified( m_editPoints->Point( DIM_CROSSBARF ) ) ) { VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() ); VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() ); if( featureLine.Cross( crossBar ) > 0 ) dimension->SetHeight( -featureLine.EuclideanNorm() ); else dimension->SetHeight( featureLine.EuclideanNorm() ); } else if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) ) { dimension->SetOrigin( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) ); m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ), m_editPoints->Point( DIM_FEATUREGO ) ) ); m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ), m_editPoints->Point( DIM_FEATUREDO ) ) ); } else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) ) { dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) ); m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ), m_editPoints->Point( DIM_FEATUREGO ) ) ); m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ), m_editPoints->Point( DIM_FEATUREDO ) ) ); } break; } default: break; } }