1 // actioninfototallength.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/04/2010 Added this text. :-)
15 #include "actioninfototallength.h"
17 #include "rs_dialogfactory.h"
19 ActionInfoTotalLength::ActionInfoTotalLength(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Info Total Length",
20 container, graphicView)
24 ActionInfoTotalLength::~ActionInfoTotalLength()
28 void ActionInfoTotalLength::init(int status)
30 ActionInterface::init(status);
34 void ActionInfoTotalLength::trigger()
36 RS_DEBUG->print("ActionInfoTotalLength::trigger()");
40 for(RS_Entity * e=container->firstEntity(RS2::ResolveNone); e!=NULL;
41 e=container->nextEntity(RS2::ResolveNone))
43 if (e->isVisible() && e->isSelected())
45 double l = e->getLength();
58 RS_DIALOGFACTORY->commandMessage(
59 tr("Total Length of selected entities: %1").arg(len));
61 RS_DIALOGFACTORY->commandMessage(tr("At least one of the selected "
62 "entities cannot be measured."));
67 void ActionInfoTotalLength::updateToolBar()
69 if (RS_DIALOGFACTORY != NULL)
72 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarInfo);
74 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);