Public Member Functions | List of all members
CmdOutputTree Class Reference
Inheritance diagram for CmdOutputTree:
Inheritance graph
[legend]
Collaboration diagram for CmdOutputTree:
Collaboration graph
[legend]

Public Member Functions

void exec () const
 
- Public Member Functions inherited from SimpleCommand< std::string >
 SimpleCommand (const std::string &name, const std::string &description, const std::string &key="value", const std::string &initValue=std::string(), const std::string &unit="")
 
 SimpleCommand (const std::string &name, const std::string &description, const std::string &key, std::initializer_list< S > l, const std::string &unit="")
 Constuctor designer for SimpleCommand<Unituple<> > .
 
 SimpleCommand (const SimpleCommand &cmd)
 
- Public Member Functions inherited from BasicCommand
 BasicCommand (const std::string &name, const std::string &description)
 
 BasicCommand (const BasicCommand &cmd)
 
- Public Member Functions inherited from BeanCommand< BeanLike >
 BeanCommand (const std::string &name, const std::string &description)
 
 BeanCommand (const BeanCommand &cmd)
 
 BeanCommand (BeanLike &b)
 
virtual const bean_tgetBean () const
 
virtual bean_tgetBean ()
 
const std::string & getName () const final
 
const std::string & getDescription () const final
 
virtual const drain::ReferenceMapgetParameters () const final
 
- Public Member Functions inherited from Command
 Command (const Command &cmd)
 
virtual void setParameters (const std::string &args) final
 
template<class T >
void setParameters (const SmartMap< T > &args)
 
template<class T >
void setParameter (const std::string &key, const T &value)
 Set a value to a single parameter. More...
 
CommandaddSection (drain::Flagger::ivalue_t i)
 
virtual void update ()
 Optional method for preparing command to execution. More...
 
bool hasParameters () const
 
virtual const std::string & getType () const
 Description of result, comparable to a return type of a function. ?
 
virtual void run (const std::string &params="")
 Convenience. Sets parameters and executes the command. More...
 
const std::string & getLastParameters () const
 After executing this command run a routine, if defined. More...
 
- Public Member Functions inherited from Contextual
 Contextual ()
 Sets internal contextPtr to NULL.
 
 Contextual (const Contextual &src)
 Copies base context (even null) of the source. Notice that the actual instance may be of derived class.
 
 Contextual (Context &ctx)
 Copies internal contextPtr.
 
template<class C >
void setContext ()
 Sets internal contextPtr to the static source.
 
void setExternalContext (Context &ctx)
 Sets internal contextPtr to outside target.
 
bool contextIsSet () const
 True, if contextPtr has been set.
 
template<class T = Context>
T & getContext () const
 If context has been set, returns it through a cast to base class Context. More...
 

Additional Inherited Members

- Public Types inherited from BeanCommand< BeanLike >
typedef BeanLike bean_t
 
- Static Public Member Functions inherited from Contextual
template<class T >
static Cloner< Context, T > & getCloner ()
 
- Public Attributes inherited from SimpleCommand< std::string >
std::string value
 
- Public Attributes inherited from BeanCommand< BeanLike >
BeanLike bean
 
- Public Attributes inherited from Command
int section = 1
 
- Static Public Attributes inherited from Command
static const SprinterLayout cmdArgLayout = {",", "?", "=", ""}
 
- Protected Member Functions inherited from BeanCommand< BeanLike >
virtual drain::ReferenceMapgetParameters () final
 
- Protected Attributes inherited from Command
std::string lastParameters
 
- Protected Attributes inherited from Contextual
ContextcontextPtr
 

Member Function Documentation

◆ exec()

void exec ( ) const
virtual
See also
Palette::exportSVGLegend() void CmdOutputPanel::exec() const {
RackContext & ctx = getContext<RackContext>();

drain::Logger mout(ctx.log, __FILE__, __FUNCTION__);
mout.attention(ctx.getName()); mout.warn("ctx.select=", ctx.select);
if (ctx.statusFlags.isSet(drain::StatusFlags::INPUT_ERROR)){
    mout.warn("input failed, skipping");
    return;
}

if (ctx.statusFlags.isSet(drain::StatusFlags::DATA_ERROR)){
    mout.warn("data error, skipping");
    return;
}

TreeSVG & // = svg["bg"]; TreeSVG svg(svg::SVG); TreeSVG svg; // (svg::SVG); REDO this, check copy constr! svg->setType(svg::SVG);

TreeSVG & main = svg["main"]; main->setType(svg::GROUP); main->set("style", "fill:green"); main->set("jimbo", 126); main->set("jimboz", true);

drain::VariableMap & variables = ctx.getStatusMap();
variables["PREFIX"] = "PANEL";

drain::StringMapper basename("${PREFIX}-${NOD}-${what:product}-${what:quantity}"); drain::BBox bboxAll; drain::BBox bbox; drain::Point2D<double> upperLeft(0,0);

ctx.updateCurrentImage(); const drain::image::Image & src = ctx.getCurrentImage(); appendImage(main, "color", variables, upperLeft, src, bbox); mout.attention("prev. BBOX: ", bbox); bboxAll.extend(bbox);

variables["what:product"] = "prod";

const drain::image::Image & src2 = ctx.getCurrentGrayImage();
upperLeft.set(bbox.upperRight.x, 0);
appendImage(main, "gray", variables, upperLeft, src2, bbox);

bboxAll.extend(bbox); mout.attention("prev. BBOX: ", bbox);

mout.attention("final BBOX: ", bboxAll);

svg->set("viewboxFOO", bbox.tuple());
svg->set("width",  +bbox.getWidth());
svg->set("height", -bbox.getHeight());

svg->set("width", src.getWidth()); svg->set("height", src.getHeight()); ctx.getCurrentGrayImage();

if (layout.empty() || layout == "basic"){

TreeSVG & radar = image["radar"]; radar->set("foo", 123); } else { mout.error("Unknown layout '", layout, "'"); }

const std::string s = filename.empty() ? layout+".svg" : filename;

if (!NodeSVG::fileInfo.checkPath(s)){ // .svg mout.fail("suspicious extension for SVG file: ", s); mout.advice("extensionRegexp: ", NodeSVG::fileInfo.extensionRegexp); }

drain::Output ofstr(s); mout.note("writing SVG file: '", s, ""); ofstr << svg; NodeSVG::toStream(ofstr, svg);

}

Reimplemented from Command.


The documentation for this class was generated from the following files: