wxArt2D
sttoolmes.cpp
1 /*! \file editor/src/sttoolmes.cpp
2  \author Klaas Holwerda
3 
4  Copyright: 2001-2004 (c) Klaas Holwerda
5 
6  Licence: wxWidgets Licence
7 
8  RCS-ID: $Id: sttoolmes.cpp,v 1.9 2009/10/01 19:22:36 titato Exp $
9 */
10 
11 #include "a2dprec.h"
12 
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16 
17 #ifndef WX_PRECOMP
18 #include "wx/wx.h"
19 #endif
20 
21 #include "wx/canvas/canmod.h"
22 #include "wx/canvas/sttoolmes.h"
23 
24 #define ID_X 10001
25 #define ID_Y 10006
26 #define ID_LISTBOX 10002
27 #define ID_HIDE 10003
28 #define ID_CLEAR 10004
29 #define ID_SUM 10005
30 
31 /*!
32  * a2dMeasureDlg type definition
33  */
34 
35 IMPLEMENT_DYNAMIC_CLASS( a2dMeasureDlg, wxDialog )
36 
37 /*!
38  * a2dMeasureDlg event table definition
39  */
40 
41 BEGIN_EVENT_TABLE( a2dMeasureDlg, wxDialog )
42  EVT_CLOSE( a2dMeasureDlg::OnCloseWindow )
43  EVT_IDLE( a2dMeasureDlg::OnIdle )
44 
45  EVT_TEXT_ENTER( ID_X, a2dMeasureDlg::OnXEnter )
46  EVT_UPDATE_UI( ID_X, a2dMeasureDlg::OnXUpdate )
47 
48  EVT_TEXT_ENTER( ID_Y, a2dMeasureDlg::OnYEnter )
49  EVT_UPDATE_UI( ID_Y, a2dMeasureDlg::OnYUpdate )
50 
51  EVT_LISTBOX( ID_LISTBOX, a2dMeasureDlg::OnListboxSelected )
52  EVT_UPDATE_UI( ID_LISTBOX, a2dMeasureDlg::OnListboxUpdate )
53 
54  EVT_BUTTON( ID_HIDE, a2dMeasureDlg::OnHideClick )
55 
56  EVT_BUTTON( ID_CLEAR, a2dMeasureDlg::OnClearClick )
57 
58  EVT_UPDATE_UI( ID_SUM, a2dMeasureDlg::OnSumUpdate )
59 
60  EVT_COM_EVENT( a2dMeasureDlg::OnComEvent )
61  EVT_DO( a2dMeasureDlg::OnDoEvent )
62  EVT_UNDO( a2dMeasureDlg::OnDoEvent )
63 
64 END_EVENT_TABLE()
65 
66 /*!
67  * a2dMeasureDlg constructors
68  */
69 
70 a2dMeasureDlg::a2dMeasureDlg( )
71 {
73  a2dCanvasGlobals->ConnectEvent( a2dEVT_COM_EVENT, this );
74 }
75 
76 a2dMeasureDlg::~a2dMeasureDlg( )
77 {
78  a2dCanvasGlobals->DisconnectEvent( a2dEVT_COM_EVENT, this );
79 }
80 
81 a2dMeasureDlg::a2dMeasureDlg( a2dHabitat* habitat, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
82 {
83  m_habitat = habitat;
85  a2dCanvasGlobals->ConnectEvent( a2dEVT_COM_EVENT, this );
86  Create( parent, id, caption, pos, size, style );
87 }
88 
89 /*!
90  * a2dMeasureDlg creator
91  */
92 
93 bool a2dMeasureDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
94 {
95  m_x = NULL;
96  m_y = NULL;
97  m_lb = NULL;
98  m_hide = NULL;
99  m_clear = NULL;
100  m_sum = NULL;
101 
102  SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
103  wxDialog::Create( parent, id, caption, pos, size, style );
104 
105  CreateControls();
106  GetSizer()->Fit( this );
107  GetSizer()->SetSizeHints( this );
108  Centre();
109  return TRUE;
110 }
111 
112 /*!
113  * Control creation for a2dMeasureDlg
114  */
115 
117 {
118  a2dMeasureDlg* itemDialog1 = this;
119 
120  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
121  itemDialog1->SetSizer( itemBoxSizer2 );
122 
123  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
124  itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 1 );
125 
126  m_x = new wxTextCtrl( itemDialog1, ID_X, _( "0" ), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
127  m_x->SetHelpText( _( "X of vertex" ) );
128  if ( ShowToolTips() )
129  m_x->SetToolTip( _( "X of vertex" ) );
130  itemBoxSizer3->Add( m_x, 1, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
131 
132  m_y = new wxTextCtrl( itemDialog1, ID_Y, _( "0" ), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
133  m_y->SetHelpText( _( "Y of vertex" ) );
134  if ( ShowToolTips() )
135  m_y->SetToolTip( _( "Y of vertex" ) );
136  itemBoxSizer3->Add( m_y, 1, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
137 
138  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxHORIZONTAL );
139  itemBoxSizer2->Add( itemBoxSizer6, 1, wxGROW | wxALL, 1 );
140 
141  wxString* m_lbStrings = NULL;
142  m_lb = new wxListBox( itemDialog1, ID_LISTBOX, wxDefaultPosition, wxDefaultSize, 0, m_lbStrings, wxLB_SINGLE | wxLB_NEEDED_SB );
143  m_lb->SetHelpText( _( "list of measured points" ) );
144  if ( ShowToolTips() )
145  m_lb->SetToolTip( _( "list of measured points" ) );
146  itemBoxSizer6->Add( m_lb, 1, wxGROW | wxALL, 1 );
147 
148  wxBoxSizer* itemBoxSizer8 = new wxBoxSizer( wxHORIZONTAL );
149  itemBoxSizer2->Add( itemBoxSizer8, 0, wxGROW | wxALL, 1 );
150 
151  m_hide = new wxButton( itemDialog1, ID_HIDE, _( "Hide" ), wxDefaultPosition, wxDefaultSize, 0 );
152  itemBoxSizer8->Add( m_hide, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
153 
154  m_clear = new wxButton( itemDialog1, ID_CLEAR, _( "Clear" ), wxDefaultPosition, wxDefaultSize, 0 );
155  m_clear->SetHelpText( _( "Clear all measured points" ) );
156  if ( ShowToolTips() )
157  m_clear->SetToolTip( _( "Clear all measured points" ) );
158  itemBoxSizer8->Add( m_clear, 0, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
159 
160  m_sum = new wxTextCtrl( itemDialog1, ID_SUM, _( "0" ), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_PROCESS_ENTER );
161  m_sum->SetHelpText( _( "Sum of all measured points to rel start" ) );
162  if ( ShowToolTips() )
163  m_sum->SetToolTip( _( "Sum of all measured points to rel start" ) );
164  itemBoxSizer8->Add( m_sum, 1, wxALIGN_CENTER_VERTICAL | wxALL, 1 );
165 }
166 
167 /*!
168  * Should we show tooltips?
169  */
170 
172 {
173  return TRUE;
174 }
175 
176 /*!
177  * Get bitmap resources
178  */
179 
180 wxBitmap a2dMeasureDlg::GetBitmapResource( const wxString& name )
181 {
182  return wxNullBitmap;
183 }
184 
185 /*!
186  * Get icon resources
187  */
188 
189 wxIcon a2dMeasureDlg::GetIconResource( const wxString& name )
190 {
191  return wxNullIcon;
192 }
193 /*!
194  * wxEVT_COMMAND_TEXT_ENTER event handler for ID_X
195  */
196 
197 void a2dMeasureDlg::OnXEnter( wxCommandEvent& event )
198 {
199  double x, y;
200  m_x->GetValue().ToDouble( &x );
201  m_y->GetValue().ToDouble( &y );
202 
203  m_habitat->SetRelativeStart( x, y );
204 
205  m_lb->Clear();
206  a2dPoint2D p1;
207  for( a2dVertexList::iterator iter = m_vertexes.begin(); iter != m_vertexes.end(); ++iter )
208  {
209  a2dLineSegment* seg = *iter;
210  p1 = seg->GetPoint();
211  AppendMeasure( p1.m_x, p1.m_y );
212  }
213  wxString tmp;
214  tmp.Printf( wxT( "%lg" ), m_vertexes.Length() );
215  m_sum->SetValue( tmp );
216 }
217 
218 /*!
219  * wxEVT_UPDATE_UI event handler for ID_X
220  */
221 
222 void a2dMeasureDlg::OnXUpdate( wxUpdateUIEvent& event )
223 {
224  event.Skip();
225 }
226 
227 /*!
228  * wxEVT_COMMAND_TEXT_ENTER event handler for ID_Y
229  */
230 
231 void a2dMeasureDlg::OnYEnter( wxCommandEvent& event )
232 {
233  double x, y;
234  m_x->GetValue().ToDouble( &x );
235  m_y->GetValue().ToDouble( &y );
236 
237  m_habitat->SetRelativeStart( x, y );
238 
239  m_lb->Clear();
240  a2dPoint2D p1;
241  for( a2dVertexList::iterator iter = m_vertexes.begin(); iter != m_vertexes.end(); ++iter )
242  {
243  a2dLineSegment* seg = *iter;
244  p1 = seg->GetPoint();
245  AppendMeasure( p1.m_x, p1.m_y );
246  }
247  wxString tmp;
248  tmp.Printf( wxT( "%lg" ), m_vertexes.Length() );
249  m_sum->SetValue( tmp );
250 }
251 
252 /*!
253  * wxEVT_UPDATE_UI event handler for ID_Y
254  */
255 
256 void a2dMeasureDlg::OnYUpdate( wxUpdateUIEvent& event )
257 {
258  event.Skip();
259 }
260 
261 /*!
262  * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_LISTBOX
263  */
264 
265 void a2dMeasureDlg::OnListboxSelected( wxCommandEvent& event )
266 {
267  event.Skip();
268 }
269 
270 /*!
271  * wxEVT_UPDATE_UI event handler for ID_LISTBOX
272  */
273 
274 void a2dMeasureDlg::OnListboxUpdate( wxUpdateUIEvent& event )
275 {
276  event.Skip();
277 }
278 
279 /*!
280  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_HIDE
281  */
282 
283 void a2dMeasureDlg::OnHideClick( wxCommandEvent& event )
284 {
285  Show( FALSE );
286 }
287 
288 /*!
289  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR
290  */
291 
292 void a2dMeasureDlg::OnClearClick( wxCommandEvent& event )
293 {
294  m_lb->Clear();
295  m_vertexes.clear();
296  event.Skip();
297 }
298 
299 /*!
300  * wxEVT_UPDATE_UI event handler for ID_SUM
301  */
302 
303 void a2dMeasureDlg::OnSumUpdate( wxUpdateUIEvent& event )
304 {
305  event.Skip();
306 }
307 
308 
309 /*!
310  * wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
311  */
312 
313 void a2dMeasureDlg::OnCloseWindow( wxCloseEvent& event )
314 {
315  Show( FALSE );
316 }
317 
318 /*!
319  * wxEVT_IDLE event handler for ID_DIALOG
320  */
321 
322 void a2dMeasureDlg::OnIdle( wxIdleEvent& event )
323 {
324  event.Skip();
325 }
326 
327 void a2dMeasureDlg::OnComEvent( a2dComEvent& event )
328 {
329  if ( GetEvtHandlerEnabled() )
330  {
331  if ( event.GetId() == a2dDrawingPart::sig_changedShowObject )
332  {
333  m_lb->Clear();
334  m_vertexes.clear();
335  }
336  else if ( event.GetId() == a2dCanvasCommandProcessor::sig_SetRelativeStart )
337  {
338  double x = m_habitat->GetRelativeStartX();
339  double y = m_habitat->GetRelativeStartY();
340  wxString coordstr;
341  coordstr.Printf( wxT( "%lg" ), x );
342  m_x->SetValue( coordstr );
343  coordstr.Printf( wxT( "%lg" ), y );
344  m_y->SetValue( coordstr );
345  }
346  else if ( event.GetId() == a2dCanvasCommandProcessor::sig_AddMeasurement )
347  {
348  a2dCanvasCommandProcessor* proc = wxStaticCast( event.GetEventObject(), a2dCanvasCommandProcessor );
349  m_vertexes.push_back( new a2dLineSegment( proc->m_meas_x, proc->m_meas_y ) );
350  wxString tmp;
351  tmp.Printf( wxT( "%lg" ), m_vertexes.Length() );
352  m_sum->SetValue( tmp );
353 
354  AppendMeasure( proc->m_meas_x, proc->m_meas_y );
355  }
356  else if ( event.GetId() == a2dCanvasCommandProcessor::sig_ClearMeasurements )
357  {
358  m_lb->Clear();
359  m_vertexes.clear();
360  }
361  }
362 
363 }
364 
365 void a2dMeasureDlg::OnDoEvent( a2dCommandProcessorEvent& event )
366 {
367  if ( GetEvtHandlerEnabled() )
368  {
369  }
370 }
371 
372 void a2dMeasureDlg::AppendMeasure( double x, double y )
373 {
374  int exp = 1;
375  double rel_x, rel_y, length, angle;
376  double start_x = wxAtoi( m_x->GetValue() );
377  double start_y = wxAtoi( m_y->GetValue() );
378 
379  rel_x = x - start_x;
380  rel_y = y - start_y;
381  length = sqrt( pow( rel_x, 2 ) + pow( rel_y, 2 ) );
382  if ( rel_x != 0 && rel_y != 0 )
383  angle = asin( rel_y / length ) * 180 / M_PI;
384  else
385  angle = 0;
386  if ( rel_x < 0 )
387  angle = 180 - angle;
388 
389  a2dDrawing* drawing = NULL;//todo GetDrawing();
390  wxString unitmeasure = wxT( "non" );
391  double scaleToMeters = 1;
392  if ( drawing )
393  {
394  unitmeasure = drawing->GetUnits();
395  scaleToMeters = drawing->GetUnitsScale();
396  }
397 
398  double multi = 1;
399  a2dDoMu::GetMultiplierFromString( unitmeasure, multi );
400 
401  x *= scaleToMeters / multi;
402  y *= scaleToMeters / multi;
403 
404 
405  wxString tmp;
406  //tmp.Printf( "(%.*f, %.*f) %s dx:%.*f dy:%.*f l:%.*f angle:%.*f", -exp, command->m_x, -exp, command->m_y,
407  // "um", -exp, rel_x, -exp, rel_y, -exp, length, -exp, angle);
408  tmp.Printf( wxT( "(%lg, %lg) %s dx:%lg dy:%lg l:%lg angle:%lg" ), x, y,
409  unitmeasure.mb_str(), rel_x, rel_y, length, angle );
410 
411  m_lb->Append( tmp );
412  m_lb->SetSelection( m_lb->GetCount() - 1, true );
413 }
414 
415 IMPLEMENT_CLASS( a2dMeasureTool, a2dDrawPolylineLTool )
416 
417 const a2dCommandId a2dMeasureTool::COMID_PushTool_Measure( wxT( "PushTool_Measure" ) );
418 
419 BEGIN_EVENT_TABLE( a2dMeasureTool, a2dDrawPolylineLTool )
420  EVT_CHAR( a2dMeasureTool::OnChar )
421  EVT_MOUSE_EVENTS( a2dMeasureTool::OnMouseEvent )
422 END_EVENT_TABLE()
423 
424 a2dMeasureTool::a2dMeasureTool( a2dStToolContr* controller ): a2dDrawPolylineLTool( controller )
425 {
426  m_eventHandler = new a2dStToolFixedToolStyleEvtHandler( controller );
427 
428  m_anotate = true;
429  m_editatend = false;
430  m_toolcursor = a2dCanvasGlobals->GetCursor( a2dCURSOR_CROSS );
431  m_toolBusyCursor = a2dCanvasGlobals->GetCursor( a2dCURSOR_CROSS );
432 
433  //i like transparent fill and specific stroke
434  SetFill( *a2dTRANSPARENT_FILL );
435  SetStroke( a2dStroke( *wxBLACK, 2, a2dSTROKE_LONG_DASH ) );
436 }
437 
438 a2dMeasureTool::~a2dMeasureTool()
439 {
440 }
441 
443 {
444  // Add old (and later new) annotation area to pending region
446 
448  double len = poly->GetSegments()->Length();
449  m_anotation.Printf( _T( "x %6.3f y %6.3f l %6.3f" ), m_xwprev, m_ywprev, len );
450  m_xanotation = m_x;
451  m_yanotation = m_y;
452 
453  wxCoord w, h, descent, external;
454  GetTextExtent( m_anotation, &w, &h, &descent, &external );
455 
456  m_xanotation = m_x + h;
457  m_yanotation = m_y + h;
458 
460 }
461 
462 void a2dMeasureTool::OnChar( wxKeyEvent& event )
463 {
464  if ( !GetBusy() )
465  {
466  switch( event.GetKeyCode() )
467  {
468  case WXK_RETURN:
469  {
471  }
472  break;
473  case WXK_SUBTRACT:
474  {
476  }
477  break;
478  default:
479  event.Skip();
480  }
481  }
482  else
483  event.Skip();
484 }
485 
486 void a2dMeasureTool::OnMouseEvent( wxMouseEvent& event )
487 {
488  if ( !m_active )
489  {
490  event.Skip();
491  return;
492  }
493 
494  if ( GetBusy() )
495  GetDrawingPart()->SetCursor( m_toolBusyCursor );
496  else
497  GetDrawingPart()->SetCursor( m_toolcursor );
498 
499  m_x = event.GetX();
500  m_y = event.GetY();
501 
503 
504  a2dRestrictionEngine* restrict = GetDrawing()->GetHabitat()->GetRestrictionEngine();
505  if( restrict )
506  restrict->RestrictPoint( m_xwprev, m_ywprev );
507 
508  if ( event.LeftDClick() && !GetBusy() )
509  {
510  GetCanvasCommandProcessor()->ClearMeasurements();
511  GetDrawing()->GetHabitat()->SetRelativeStart( m_xwprev, m_ywprev );
512  }
513  if ( event.LeftDClick() && GetBusy() )
514  {
515  // force this, since this tool does never want that.
516  m_editatend = false;
517  GetCanvasCommandProcessor()->ClearMeasurements();
518  event.Skip();
519  }
520  else if ( event.LeftDown() && !GetBusy() )
521  {
522  GetCanvasCommandProcessor()->SetRelativeStart( m_xwprev, m_ywprev );
523 
524  GetDrawing()->GetHabitat()->SetLastXyEntry( m_xwprev, m_ywprev );
533  if ( line->GetBegin() && line->GetBegin()->GetFlag( a2dCanvasOFlags::normalized ) )
534  {
535  line->GetBegin()->SetSpecificFlags( false, a2dCanvasOFlags::normalized );
536  double norm = GetDrawingPart()->GetDrawing()->GetNormalizeScale();
537  line->GetBegin()->Scale( norm, norm );
538  }
539  if ( line->GetEnd() && line->GetEnd()->GetFlag( a2dCanvasOFlags::normalized ) )
540  {
541  line->GetEnd()->SetSpecificFlags( false, a2dCanvasOFlags::normalized );
542  double norm = GetDrawingPart()->GetDrawing()->GetNormalizeScale();
543  line->GetEnd()->Scale( norm, norm );
544  }
545 
546  EnterBusyMode();
548 
549  m_points = wxStaticCast( m_canvasobject.Get(), a2dPolylineL )->GetSegments();
550 
551  a2dGeneralGlobals->RecordF( this, _T( "polyline" ) );
552 
553  // add point to the original
554  if ( m_reverse )
557  );
558  else
561  );
562 
564  AddPoint( m_point );
565 
566  a2dGeneralGlobals->RecordF( this, _T( "addpoint %f %f " ), m_xwprev, m_ywprev );
567 
568  //add second point to drag
570  AddPoint( m_point );
571 
572  m_prev_x = m_xwprev;
573  m_prev_y = m_ywprev;
574 
575  if( restrict )
576  restrict->SetRestrictPoint( m_xwprev, m_ywprev );
577 
578  m_pending = true;
579  }
580  else if ( event.LeftDown() && GetBusy() )
581  {
582  GetCanvasCommandProcessor()->AddMeasurement( m_xwprev, m_ywprev );
583  event.Skip();
584  }
585  else
586  event.Skip();
587 }
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
Definition: artglob.h:47
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
Definition: sttoolmes.cpp:189
a2dCanvasObjectPtr m_canvasobject
This is the object currently edited.
Definition: sttool.h:381
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
stack based tools for measuring
bool m_pending
set when tool needs an redraw (after a a2dCanvas Repaint etc.)
Definition: tools.h:814
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
Returns a pointer to the command processor associated with this document.
Definition: tools.cpp:976
wxUint16 m_layer
layer for a new object
Definition: tools.h:832
wxCursor m_toolcursor
cursor to use
Definition: tools.h:768
double GetNormalizeScale()
Normalize objects ( defined in coordinates -1 to 1 ranges ) will be multiplied by this factor...
Definition: drawing.h:693
a2dMeasureDlg()
Constructors.
Definition: sttoolmes.cpp:70
double m_contourwidth
if != 0 the polygon is contoured at distance m_contourwidth/2
Definition: tools.h:829
int m_x
x of mouse in device
Definition: sttool.h:352
a2dCanvasObjectPtr m_original
This is the original object selected for editing.
Definition: sttool.h:388
void AddDecorationObject(a2dCanvasObject *object)
Add a decoration object to be rendered by the tool.
Definition: tools.cpp:932
used to add points to polygon objects
Definition: drawing.h:1959
virtual void SetContourWidth(double width)
set the Contour width of the shape
Definition: canobj.h:1408
#define EVT_DO(func)
event sent from a2DocumentCommandProcessor when a command is initially done
Definition: comevt.h:795
static bool ShowToolTips()
Should we show tooltips?
Definition: sttoolmes.cpp:171
a2dDrawingPart * GetDrawingPart()
Access to the tool controllers drawer.
Definition: tools.h:632
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
Definition: gen.cpp:876
a2dStToolContr * m_stcontroller
controller for canvas
Definition: sttool.h:391
a2dDrawing * GetDrawing()
Returns a pointer to the drawing.
Definition: tools.cpp:969
if set, clone childs, otherwise ref-copy them
Definition: gen.h:1207
bool Create(wxWindow *parent, wxWindowID id=-1, const wxString &caption=SYMBOL_A2DMEASUREDLG_TITLE, const wxPoint &pos=SYMBOL_A2DMEASUREDLG_POSITION, const wxSize &size=SYMBOL_A2DMEASUREDLG_SIZE, long style=SYMBOL_A2DMEASUREDLG_STYLE)
Creation.
Definition: sttoolmes.cpp:93
wxString m_anotation
anotation string, which is in general modified by the tools to display position etc.
Definition: sttool.h:340
a command processor specially designed to work with a a2dCanvasDocument
Definition: drawing.h:1046
void OnClearClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_CLEAR
Definition: sttoolmes.cpp:292
bool m_active
tool is operational
Definition: tools.h:777
double m_ywprev
y world coordinates old or new value of mouse
Definition: sttool.h:366
bool GetFlag(const a2dCanvasObjectFlagsMask which) const
get specific bitflag value
Definition: canobj.cpp:2655
void OnSumUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_SUM
Definition: sttoolmes.cpp:303
void Zoomout()
show all on canvas
Definition: sttool.cpp:378
void OnCloseWindow(wxCloseEvent &event)
wxEVT_CLOSE_WINDOW event handler for ID_DIALOG
Definition: sttoolmes.cpp:313
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
Definition: canglob.h:1262
a2dStroke m_stroke
stroke for new object
Definition: tools.h:826
bool EnterBusyMode()
starts a new action (e.g drawing something ) in a tool that is already pushed.
Definition: sttool.cpp:1731
void OnListboxSelected(wxCommandEvent &event)
wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_LISTBOX
Definition: sttoolmes.cpp:265
void ZoomUndo()
go to previous zoom area (used while another tool is active)
Definition: sttool.cpp:362
double GetRelativeStartY() const
holds last RelativeStart measurement Y position in world coordinates
Definition: canglob.h:790
static const a2dCanvasObjectFlagsMask normalized
Definition: candefs.h:217
void OnXEnter(wxCommandEvent &event)
wxEVT_COMMAND_TEXT_ENTER event handler for ID_X
Definition: sttoolmes.cpp:197
Interactive Selection of an Object.
Definition: sttoolmes.h:143
a2dFill m_fill
fill for new object
Definition: tools.h:823
void AddAnotationToPendingUpdateArea()
after calculating anotation position and string, extend the boundingbox of the tools with it...
Definition: sttool.cpp:1358
static const a2dSignal sig_changedShowObject
Definition: drawer.h:1513
a2dSmrtPtr< a2dPolygonL > m_templateObject
object to clone to use as start
Definition: sttool.h:1772
polyline defined with list of points.
Definition: polygon.h:332
The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.
Definition: sttool.h:485
double GetRelativeStartX() const
holds last RelativeStart measurement X position in world coordinates
Definition: canglob.h:788
void OnYUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_Y
Definition: sttoolmes.cpp:256
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
Definition: gen.h:564
bool m_editatend
when drawing something editing must follow, using the a2dRecursiveEditTool
Definition: sttool.h:409
wxCursor m_toolBusyCursor
cursor to use when the tool is busy doing something.
Definition: tools.h:771
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Definition: gen.h:123
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
Definition: polygon.h:219
Normal straight line segment in a2dVertexList and a2dVertexArray.
Definition: polyver.h:163
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
Definition: canobj.cpp:2645
int m_yanotation
y position of anotation text
Definition: sttool.h:346
void OnChar(wxKeyEvent &event)
character handling
Definition: sttoolmes.cpp:462
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
Definition: comevt.cpp:1148
void Translate(double x, double y)
relative translate the object to position x,y in world coordinates
Definition: canobj.h:569
Restriction engine for editing restrictions like snapping.
Definition: restrict.h:88
static bool GetMultiplierFromString(const wxString &mul, double &multi)
calculate how to get to meters from a multiplier string e.g. um =&gt; 1e-6
Definition: artglob.cpp:293
bool m_reverse
end to begin wire.
Definition: sttool.h:1786
void CreateControls()
Creates the controls and sizers.
Definition: sttoolmes.cpp:116
Each a2dCommand is given a command id at construction.
Definition: comevt.h:99
defines common settinsg for a habitat for a set of a2dCameleons.
Definition: canglob.h:439
void OnYEnter(wxCommandEvent &event)
wxEVT_COMMAND_TEXT_ENTER event handler for ID_Y
Definition: sttoolmes.cpp:231
void SetLastXyEntry(double x, double y)
set last mouse X position in world coordinates, as set by tools.
Definition: canglob.h:774
void OnIdle(wxIdleEvent &event)
wxEVT_IDLE event handler for ID_DIALOG
Definition: sttoolmes.cpp:322
makes a tool fixed in style.
Definition: sttool.h:2369
double m_xwprev
x world coordinates old or new value of mouse
Definition: sttool.h:363
void SetRelativeStart(double x, double y)
set RelativeStart measurement X and Y position in world coordinates
Definition: canglob.h:785
virtual void GenerateAnotation()
to display a string along with a tool drawing.
Definition: sttoolmes.cpp:442
void OnListboxUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_LISTBOX
Definition: sttoolmes.cpp:274
a2dLineSegment * m_point
last point
Definition: sttool.h:1783
virtual bool Submit(a2dCommand *command, bool storeIt=true)
Definition: drawing.cpp:5966
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
Definition: canobj.cpp:2924
void Scale(double scalex, double scaley)
Scale in x and y ( &gt; zero)
Definition: canobj.cpp:2633
void OnHideClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_HIDE
Definition: sttoolmes.cpp:283
int m_y
y of mouse in device
Definition: sttool.h:354
a2dRestrictionEngine * GetRestrictionEngine()
Get restriction engine (grid snapping)
Definition: canglob.cpp:934
double m_prev_y
previous y
Definition: sttool.h:1777
double GetUnitsScale()
this is the number that defines the physical dimension in meters / inch/ etc.
Definition: drawing.h:676
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
Definition: drawing.cpp:375
wxString GetUnits()
this string defines the unit e.g. meters / inch/ etc.
Definition: drawing.h:707
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
a2dVertexList * m_points
points sofar
Definition: sttool.h:1780
virtual bool EliminateMatrix()
reduce matrix to identity
Definition: canobj.cpp:6191
if set, clone members (e.g. line end styles), otherwise ref-copy them
Definition: gen.h:1203
see a2dComEvent
Definition: gen.h:371
void GetTextExtent(const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=NULL, wxCoord *externalLeading=NULL)
return text extends of string
Definition: sttool.cpp:1069
a2dDrawing * GetDrawing() const
get drawing via top object
Definition: drawer.cpp:726
double Length()
calculate length of path
Definition: polyver.cpp:1772
void OnXUpdate(wxUpdateUIEvent &event)
wxEVT_UPDATE_UI event handler for ID_X
Definition: sttoolmes.cpp:222
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
Definition: canglob.cpp:1234
all headers of the canvas module
#define EVT_UNDO(func)
event sent from a2DocumentCommandProcessor when a command is undone
Definition: comevt.h:797
void MouseToToolWorld(int x, int y, double &xWorldLocal, double &yWorldLocal)
calculate world coordinates from devide coordinates
Definition: sttool.cpp:1622
bool GetBusy()
Check if the tool is busy editing a distinct object */.
Definition: tools.h:513
Interactive drawing of a polyline.
Definition: sttool.h:1806
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
Definition: canobj.cpp:5920
int m_xanotation
x position of anotation text
Definition: sttool.h:343
void SetRestrictPoint(double xSnap, double ySnap)
sets the point for snapping to
Definition: restrict.h:337
double m_prev_x
previous x
Definition: sttool.h:1775
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
Definition: gen.cpp:902
Contain one drawing as hierarchical tree of a2dCanvasObject&#39;s.
Definition: drawing.h:434
virtual bool RestrictPoint(double &x, double &y, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false)
Restrict a single point of a line or polyline.
Definition: restrict.cpp:227
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
Definition: sttoolmes.cpp:180
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
Definition: canobj.cpp:2874
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
sttoolmes.cpp Source File -- Sun Oct 12 2014 17:04:25 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation