42#define SCALING_FACTOR schIUScale.mmToIU( 0.15 )
92 std::shared_ptr<ERC_ITEM>
erc = std::static_pointer_cast<ERC_ITEM>(
m_rcItem );
93 wxString sheetSpecificPath, mainItemPath, auxItemPath;
95 if(
erc->IsSheetSpecific() )
96 sheetSpecificPath =
erc->GetSpecificSheetPath().Path().AsString();
98 if(
erc->MainItemHasSheetPath() )
99 mainItemPath =
erc->GetMainItemSheetPath().Path().AsString();
101 if(
erc->AuxItemHasSheetPath() )
102 auxItemPath =
erc->GetAuxItemSheetPath().Path().AsString();
120 return wxString::Format( wxT(
"%s|%d|%d|%s|%s|%s|%s|%s" ),
124 parent->m_Uuid.AsString(),
125 text_item->GetText(),
133 return wxString::Format( wxT(
"%s|%d|%d|%s|%s|%s|%s|%s" ),
134 m_rcItem->GetSettingsKey(),
137 m_rcItem->GetMainItemID().AsString(),
138 m_rcItem->GetAuxItemID().AsString(),
146 const wxString& data )
148 wxArrayString props = wxSplit( data,
'|' );
149 VECTOR2I markerPos( (
int) strtol( props[1].c_str(),
nullptr, 10 ),
150 (
int) strtol( props[2].c_str(),
nullptr, 10 ) );
165 if( !props[4].IsEmpty() )
176 if( text_item->GetText() == props[4] )
180 RECURSE_MODE::NO_RECURSE );
194 if( text_item->GetText() == props[4] )
198 RECURSE_MODE::NO_RECURSE );
202 ercItem->SetItems( uuid );
208 ercItem->SetItems(
KIID( props[3] ) );
213 ercItem->SetItems(
KIID( props[3] ),
KIID( props[4] ) );
216 bool isLegacyMarker =
true;
222 if( props.size() == 8 )
224 isLegacyMarker =
false;
226 if( !props[5].IsEmpty() )
228 KIID_PATH sheetSpecificKiidPath( props[5] );
229 std::optional<SCH_SHEET_PATH> sheetSpecificPath =
232 if( sheetSpecificPath.has_value() )
233 ercItem->SetSheetSpecificPath( sheetSpecificPath.value() );
236 if( !props[6].IsEmpty() )
239 std::optional<SCH_SHEET_PATH> mainItemPath =
242 if( mainItemPath.has_value() )
244 if( props[7].IsEmpty() )
246 ercItem->SetItemsSheetPaths( mainItemPath.value() );
251 std::optional<SCH_SHEET_PATH> auxItemPath =
254 if( auxItemPath.has_value() )
255 ercItem->SetItemsSheetPaths( mainItemPath.value(), auxItemPath.value() );
270void SCH_MARKER::Show(
int nestLevel, std::ostream& os )
const
273 NestedSpace( nestLevel, os ) <<
'<' <<
GetClass().Lower().mb_str() <<
GetPos() <<
"/>\n";
281 wxCHECK2_MSG(
Schematic(),
return {},
"No SCHEMATIC set for SCH_MARKER!" );
284 std::shared_ptr<ERC_ITEM> ercItem = std::static_pointer_cast<ERC_ITEM>(
GetRCItem() );
286 if( ercItem->IsSheetSpecific()
287 && ( ercItem->GetSpecificSheetPath() !=
Schematic()->CurrentSheet() ) )
292 std::vector<int> layers( 2 );
303 case SEVERITY::RPT_SEVERITY_ERROR: layers[0] =
LAYER_ERC_ERR;
break;
304 case SEVERITY::RPT_SEVERITY_WARNING: layers[0] =
LAYER_ERC_WARN;
break;
360 aList.emplace_back(
_(
"Type" ),
_(
"Marker" ) );
361 aList.emplace_back(
_(
"Violation" ),
m_rcItem->GetErrorMessage() );
366 aList.emplace_back(
_(
"Severity" ),
_(
"Ignore" ) );
369 aList.emplace_back(
_(
"Severity" ),
_(
"Warning" ) );
372 aList.emplace_back(
_(
"Severity" ),
_(
"Error" ) );
380 aList.emplace_back(
_(
"Drawing Sheet" ), wxEmptyString );
401 aList.emplace_back( mainText, auxText );
405 aList.emplace_back(
_(
"Excluded" ),
m_comment );
BITMAPS
A list of all bitmap identifiers.
The base class for create windows for drawing purpose.
virtual EDA_ITEM * ResolveItem(const KIID &aId, bool aAllowNullptrReturn=false) const
Fetch an item by KIID.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const
Return a user-visible description string of this item.
KICAD_T Type() const
Returns the type of object.
virtual bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxData) const
Compare the item against the search criteria in aSearchData.
EDA_ITEM * GetParent() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
static std::shared_ptr< ERC_ITEM > Create(int aErrorCode)
Constructs an ERC_ITEM for the given error code.
SEVERITY GetSeverity(int aErrorCode) const
A color representation with 4 components: red, green, blue, alpha.
Marker are mainly used to show a DRC or ERC error or warning.
bool HitTestMarker(const VECTOR2I &aHitPosition, int aAccuracy) const
Test if the given VECTOR2I is within the bounds of this object.
std::shared_ptr< RC_ITEM > GetRCItem() const
int m_scalingFactor
Scaling factor to convert corners coordinates to internal units coordinates.
wxString m_comment
User supplied comment.
const VECTOR2I & GetPos() const
VECTOR2I m_Pos
Position of the marker.
MARKER_T m_markerType
The type of marker.
bool m_excluded
User has excluded this specific error.
std::shared_ptr< RC_ITEM > m_rcItem
enum MARKER_T GetMarkerType() const
BOX2I m_shapeBoundingBox
Bounding box of the graphic symbol relative to the position of the shape in marker shape units.
BOX2I GetBoundingBoxMarker() const
Return the orthogonal, bounding box of this object for display purposes.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
ERC_SETTINGS & ErcSettings() const
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode)
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
SEVERITY GetSeverity() const override
bool Matches(const EDA_SEARCH_DATA &aSearchData, void *aAuxDat) const override
Compare DRC marker main and auxiliary text against search string.
wxString GetClass() const override
Return the class name.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
static SCH_MARKER * DeserializeFromString(const SCH_SHEET_LIST &aSheetList, const wxString &data)
bool m_isLegacyMarker
True if marker was deserialized from a file version < 20230121.
void SetIsLegacyMarker(bool isLegacyMarker=true)
Set this marker as a legacy artifact.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
SCH_LAYER_ID GetColorLayer() const
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
wxString SerializeToString() const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
KIGFX::COLOR4D getColor() const override
BOX2I const GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
SCH_MARKER(std::shared_ptr< ERC_ITEM > aItem, const VECTOR2I &aPos)
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
std::optional< SCH_SHEET_PATH > GetSheetPathByKIIDPath(const KIID_PATH &aPath, bool aIncludeLastSheet=true) const
Finds a SCH_SHEET_PATH that matches the provided KIID_PATH.
SCH_ITEM * ResolveItem(const KIID &aID, SCH_SHEET_PATH *aPathOut=nullptr, bool aAllowNullptrReturn=false) const
Fetch a SCH_ITEM by ID.
void RunOnChildren(const std::function< void(SCH_ITEM *)> &aFunction, RECURSE_MODE aMode) override
@ ERCE_UNRESOLVED_VARIABLE
A text variable could not be resolved.
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_SELECTION_SHADOWS
Message panel definition file.
#define SCALING_FACTOR
Factor to convert the maker unit shape to internal units:
Functions to provide common constants and other functions to assist in making a consistent UI.