Formatting

This commit is contained in:
Jeff Young 2020-11-04 13:46:51 +00:00
parent dd428b3d5a
commit f6c17001e4
2 changed files with 53 additions and 54 deletions

View File

@ -22,20 +22,19 @@
*/ */
#include <preview_items/two_point_assistant.h> #include <preview_items/two_point_assistant.h>
#include <preview_items/draw_context.h> #include <preview_items/draw_context.h>
#include <preview_items/preview_utils.h> #include <preview_items/preview_utils.h>
#include <view/view.h> #include <view/view.h>
#include <common.h> #include <common.h>
#include <pcb_painter.h>
using namespace KIGFX::PREVIEW; using namespace KIGFX::PREVIEW;
TWO_POINT_ASSISTANT::TWO_POINT_ASSISTANT( TWO_POINT_ASSISTANT::TWO_POINT_ASSISTANT( const TWO_POINT_GEOMETRY_MANAGER& aManager,
const TWO_POINT_GEOMETRY_MANAGER& aManager, EDA_UNITS aUnits, GEOM_SHAPE aShape ) EDA_UNITS aUnits, GEOM_SHAPE aShape ) :
: EDA_ITEM( NOT_USED ), m_constructMan( aManager ), m_units( aUnits ), m_shape( aShape ) EDA_ITEM( NOT_USED ),
m_constructMan( aManager ),
m_units( aUnits ),
m_shape( aShape )
{ {
} }
@ -94,6 +93,5 @@ void TWO_POINT_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
} }
// place the text next to cursor, on opposite side from drawing // place the text next to cursor, on opposite side from drawing
DrawTextNextToCursor( aView, end, origin - end, cursorStrings, DrawTextNextToCursor( aView, end, origin - end, cursorStrings, aLayer == LAYER_SELECT_OVERLAY );
aLayer == LAYER_SELECT_OVERLAY );
} }

View File

@ -33,60 +33,61 @@ namespace KIGFX
namespace PREVIEW namespace PREVIEW
{ {
// TODO: required until PCB_SHAPE_TYPE_T is moved into commons or a better approach is found // TODO: required until PCB_SHAPE_TYPE_T is moved into commons or a better approach is found
enum class GEOM_SHAPE enum class GEOM_SHAPE
{
SEGMENT = 0,
RECT,
ARC,
CIRCLE,
POLYGON,
CURVE
};
/**
* Represents an assistant draw when interactively drawing a line or circle on a canvas.
*/
class TWO_POINT_ASSISTANT : public EDA_ITEM
{
public:
TWO_POINT_ASSISTANT( const TWO_POINT_GEOMETRY_MANAGER& aManager, EDA_UNITS aUnits,
GEOM_SHAPE aShape );
const BOX2I ViewBBox() const override;
void ViewGetLayers( int aLayers[], int& aCount ) const override
{ {
SEGMENT = 0, aLayers[0] = LAYER_SELECT_OVERLAY; // Assitant graphics
RECT, aLayers[1] = LAYER_GP_OVERLAY; // Drop shadows
ARC, aCount = 2;
CIRCLE, }
POLYGON,
CURVE
};
/** /**
* Represents an assistant draw when interactively drawing a line or circle on a canvas. * Draw the assistance (with reference to the contstruction manager
*/ */
class TWO_POINT_ASSISTANT : public EDA_ITEM void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
{
public:
TWO_POINT_ASSISTANT(
const TWO_POINT_GEOMETRY_MANAGER& aManager, EDA_UNITS aUnits, GEOM_SHAPE aShape );
const BOX2I ViewBBox() const override;
void ViewGetLayers( int aLayers[], int& aCount ) const override
{
aLayers[0] = LAYER_SELECT_OVERLAY; // Assitant graphics
aLayers[1] = LAYER_GP_OVERLAY; // Drop shadows
aCount = 2;
}
/**
* Draw the assistance (with reference to the contstruction manager
*/
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
#if defined( DEBUG ) #if defined( DEBUG )
void Show( int x, std::ostream& st ) const override void Show( int x, std::ostream& st ) const override
{ {
} }
#endif #endif
/** /**
* Get class name * Get class name
* @return string "TWO_POINT_ASSISTANT" * @return string "TWO_POINT_ASSISTANT"
*/ */
wxString GetClass() const override wxString GetClass() const override
{ {
return "TWO_POINT_ASSISTANT"; return "TWO_POINT_ASSISTANT";
} }
private:
const TWO_POINT_GEOMETRY_MANAGER& m_constructMan;
EDA_UNITS m_units;
GEOM_SHAPE m_shape;
};
private:
const TWO_POINT_GEOMETRY_MANAGER& m_constructMan;
EDA_UNITS m_units;
GEOM_SHAPE m_shape;
};
} // namespace PREVIEW } // namespace PREVIEW
} // namespace KIGFX } // namespace KIGFX