added option for underlay opacity change
adjusted interface [removed invalid const]
This commit is contained in:
@@ -20,6 +20,7 @@ private:
|
|||||||
std::string tmpFile;
|
std::string tmpFile;
|
||||||
Floorplan::UnderlayImage* underlay;
|
Floorplan::UnderlayImage* underlay;
|
||||||
BBox2 bbox;
|
BBox2 bbox;
|
||||||
|
float opacity = 0.5;
|
||||||
|
|
||||||
int selPoint = -1;
|
int selPoint = -1;
|
||||||
|
|
||||||
@@ -55,6 +56,9 @@ public:
|
|||||||
selPoint = -1; // clear selection
|
selPoint = -1; // clear selection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float getOpacity() const {return opacity;}
|
||||||
|
void setOpacity(const float o) {this->opacity = o;}
|
||||||
|
|
||||||
void paint(Painter& p) override {
|
void paint(Painter& p) override {
|
||||||
(void) p;
|
(void) p;
|
||||||
|
|
||||||
@@ -101,9 +105,9 @@ public:
|
|||||||
imgScaled = QImage();
|
imgScaled = QImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// current opacity?
|
||||||
float opacity = p.p->opacity();
|
float _oldOpacity = p.p->opacity();
|
||||||
p.p->setOpacity(0.50f);
|
p.p->setOpacity(opacity);
|
||||||
|
|
||||||
// render downscaled image from cache? or use live-upscaling (faster, eats up less memory, ...)
|
// render downscaled image from cache? or use live-upscaling (faster, eats up less memory, ...)
|
||||||
if (imgScaled.width() > 0) {
|
if (imgScaled.width() > 0) {
|
||||||
@@ -113,7 +117,8 @@ public:
|
|||||||
p.p->drawImage(QRectF(sx1, sy1-sh, sw, sh), img, QRectF(0,0,img.width(),img.height()));
|
p.p->drawImage(QRectF(sx1, sy1-sh, sw, sh), img, QRectF(0,0,img.width(),img.height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
p.p->setOpacity(opacity);
|
// reset
|
||||||
|
p.p->setOpacity(_oldOpacity);
|
||||||
|
|
||||||
// selected endpoint(s)?
|
// selected endpoint(s)?
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
|
|||||||
@@ -282,6 +282,7 @@ private:
|
|||||||
|
|
||||||
(void) m;
|
(void) m;
|
||||||
|
|
||||||
|
// currently: only accept keys when something is focused
|
||||||
if (focused) {
|
if (focused) {
|
||||||
|
|
||||||
// pass it to the element which may consume this event
|
// pass it to the element which may consume this event
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public:
|
|||||||
virtual ParamValue getParamValue(const int idx) const = 0;
|
virtual ParamValue getParamValue(const int idx) const = 0;
|
||||||
|
|
||||||
/** set the idx-th param's value */
|
/** set the idx-th param's value */
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const = 0;
|
virtual void setParamValue(const int idx, const ParamValue& val) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: floor->name = val.toString(); break;
|
case 0: floor->name = val.toString(); break;
|
||||||
case 1: floor->height = val.toFloat(); break;
|
case 1: floor->height = val.toFloat(); break;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: ap->name = val.toString(); break;
|
case 0: ap->name = val.toString(); break;
|
||||||
case 1: ap->mac = val.toString(); break;
|
case 1: ap->mac = val.toString(); break;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: b->name = val.toString(); break;
|
case 0: b->name = val.toString(); break;
|
||||||
case 1: b->pos = val.toPoint3(); break;
|
case 1: b->pos = val.toPoint3(); break;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: elevator->width = val.toFloat(); break;
|
case 0: elevator->width = val.toFloat(); break;
|
||||||
case 1: elevator->depth = val.toFloat(); break;
|
case 1: elevator->depth = val.toFloat(); break;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: fpl->name = val.toString(); break;
|
case 0: fpl->name = val.toString(); break;
|
||||||
case 1: fpl->posOnFloor = val.toPoint2(); break;
|
case 1: fpl->posOnFloor = val.toPoint2(); break;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: gtp->id = val.toInt(); break;
|
case 0: gtp->id = val.toInt(); break;
|
||||||
case 1: gtp->pos = val.toPoint3(); break;
|
case 1: gtp->pos = val.toPoint3(); break;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** set the idx-th param's value */
|
/** set the idx-th param's value */
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case 0: break;
|
case 0: break;
|
||||||
case 1: fo->height = val.toFloat(); break;
|
case 1: fo->height = val.toFloat(); break;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: break;
|
case 0: break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: fo->name = val.toString(); break;
|
case 0: fo->name = val.toString(); break;
|
||||||
case 1: fo->outdoor = val.toBool(); break;
|
case 1: fo->outdoor = val.toBool(); break;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
case 0: poi->name = val.toString(); break;
|
case 0: poi->name = val.toString(); break;
|
||||||
case 1: poi->type = (Floorplan::POIType) val.toInt(); break;
|
case 1: poi->type = (Floorplan::POIType) val.toInt(); break;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
throw 1;
|
throw 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
const int selPart = mv2d.getSelPart();
|
const int selPart = mv2d.getSelPart();
|
||||||
const int selNode = mv2d.getSelNode();
|
const int selNode = mv2d.getSelNode();
|
||||||
switch(idx) {
|
switch(idx) {
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ public:
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNumParams() const override {return 4;}
|
int getNumParams() const override {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
virtual Param getParamDesc(const int idx) const override {
|
virtual Param getParamDesc(const int idx) const override {
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
@@ -47,6 +49,7 @@ public:
|
|||||||
case 1: return Param("scale X", ParamType::FLOAT);
|
case 1: return Param("scale X", ParamType::FLOAT);
|
||||||
case 2: return Param("scale Y", ParamType::FLOAT);
|
case 2: return Param("scale Y", ParamType::FLOAT);
|
||||||
case 3: return Param("Anchor", ParamType::POINT2);
|
case 3: return Param("Anchor", ParamType::POINT2);
|
||||||
|
case 4: return Param("opacity", ParamType::FLOAT);
|
||||||
default: throw 1;
|
default: throw 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,16 +60,18 @@ public:
|
|||||||
case 1: return ParamValue(img->scaleX);
|
case 1: return ParamValue(img->scaleX);
|
||||||
case 2: return ParamValue(img->scaleY);
|
case 2: return ParamValue(img->scaleY);
|
||||||
case 3: return ParamValue(img->anchor);
|
case 3: return ParamValue(img->anchor);
|
||||||
|
case 4: return ParamValue(mv2d.getOpacity());
|
||||||
default: throw 1;
|
default: throw 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setParamValue(const int idx, const ParamValue& val) const override {
|
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case 0: img->filename = val.toString(); break;
|
case 0: img->filename = val.toString(); break;
|
||||||
case 1: img->scaleX = val.toFloat(); break;
|
case 1: img->scaleX = val.toFloat(); break;
|
||||||
case 2: img->scaleY = val.toFloat(); break;
|
case 2: img->scaleY = val.toFloat(); break;
|
||||||
case 3: img->anchor = val.toPoint2(); break;
|
case 3: img->anchor = val.toPoint2(); break;
|
||||||
|
case 4: mv2d.setOpacity(val.toFloat()); break;
|
||||||
default: throw 1;
|
default: throw 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user