diff --git a/mapview/2D/MV2DElementFloorUnderlay.h b/mapview/2D/MV2DElementFloorUnderlay.h index 77be436..94f5858 100644 --- a/mapview/2D/MV2DElementFloorUnderlay.h +++ b/mapview/2D/MV2DElementFloorUnderlay.h @@ -20,6 +20,7 @@ private: std::string tmpFile; Floorplan::UnderlayImage* underlay; BBox2 bbox; + float opacity = 0.5; int selPoint = -1; @@ -55,6 +56,9 @@ public: selPoint = -1; // clear selection } + float getOpacity() const {return opacity;} + void setOpacity(const float o) {this->opacity = o;} + void paint(Painter& p) override { (void) p; @@ -101,9 +105,9 @@ public: imgScaled = QImage(); } - - float opacity = p.p->opacity(); - p.p->setOpacity(0.50f); + // current opacity? + float _oldOpacity = p.p->opacity(); + p.p->setOpacity(opacity); // render downscaled image from cache? or use live-upscaling (faster, eats up less memory, ...) 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->setOpacity(opacity); + // reset + p.p->setOpacity(_oldOpacity); // selected endpoint(s)? if (hasFocus()) { diff --git a/mapview/2D/tools/ToolSelector.h b/mapview/2D/tools/ToolSelector.h index d86f000..fcb030f 100644 --- a/mapview/2D/tools/ToolSelector.h +++ b/mapview/2D/tools/ToolSelector.h @@ -282,6 +282,7 @@ private: (void) m; + // currently: only accept keys when something is focused if (focused) { // pass it to the element which may consume this event diff --git a/mapview/model/IHasParams.h b/mapview/model/IHasParams.h index 8797823..296e526 100644 --- a/mapview/model/IHasParams.h +++ b/mapview/model/IHasParams.h @@ -104,7 +104,7 @@ public: virtual ParamValue getParamValue(const int idx) const = 0; /** 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; }; diff --git a/mapview/model/MMFloor.h b/mapview/model/MMFloor.h index 778ee4d..adc978b 100644 --- a/mapview/model/MMFloor.h +++ b/mapview/model/MMFloor.h @@ -83,7 +83,7 @@ public: 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) { case 0: floor->name = val.toString(); break; case 1: floor->height = val.toFloat(); break; diff --git a/mapview/model/MMFloorAccessPoint.h b/mapview/model/MMFloorAccessPoint.h index f71ab5c..edea9af 100644 --- a/mapview/model/MMFloorAccessPoint.h +++ b/mapview/model/MMFloorAccessPoint.h @@ -54,7 +54,7 @@ public: 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) { case 0: ap->name = val.toString(); break; case 1: ap->mac = val.toString(); break; diff --git a/mapview/model/MMFloorBeacon.h b/mapview/model/MMFloorBeacon.h index fffe8a8..27b7b9e 100644 --- a/mapview/model/MMFloorBeacon.h +++ b/mapview/model/MMFloorBeacon.h @@ -56,7 +56,7 @@ public: 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) { case 0: b->name = val.toString(); break; case 1: b->pos = val.toPoint3(); break; diff --git a/mapview/model/MMFloorElevator.h b/mapview/model/MMFloorElevator.h index c83a956..17ccaaa 100644 --- a/mapview/model/MMFloorElevator.h +++ b/mapview/model/MMFloorElevator.h @@ -47,7 +47,7 @@ public: 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) { case 0: elevator->width = val.toFloat(); break; case 1: elevator->depth = val.toFloat(); break; diff --git a/mapview/model/MMFloorFingerprintLocation.h b/mapview/model/MMFloorFingerprintLocation.h index eeac267..dd5cc4b 100644 --- a/mapview/model/MMFloorFingerprintLocation.h +++ b/mapview/model/MMFloorFingerprintLocation.h @@ -49,7 +49,7 @@ public: 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) { case 0: fpl->name = val.toString(); break; case 1: fpl->posOnFloor = val.toPoint2(); break; diff --git a/mapview/model/MMFloorGroundTruthPoint.h b/mapview/model/MMFloorGroundTruthPoint.h index 67ba358..1875ce9 100644 --- a/mapview/model/MMFloorGroundTruthPoint.h +++ b/mapview/model/MMFloorGroundTruthPoint.h @@ -42,7 +42,7 @@ public: 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) { case 0: gtp->id = val.toInt(); break; case 1: gtp->pos = val.toPoint3(); break; diff --git a/mapview/model/MMFloorObstacleDoor.h b/mapview/model/MMFloorObstacleDoor.h index d1816a5..1efb4da 100644 --- a/mapview/model/MMFloorObstacleDoor.h +++ b/mapview/model/MMFloorObstacleDoor.h @@ -70,7 +70,7 @@ public: } /** 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) { case 0: break; case 1: fo->height = val.toFloat(); break; diff --git a/mapview/model/MMFloorObstacleLine.h b/mapview/model/MMFloorObstacleLine.h index 31c165e..6de5d13 100644 --- a/mapview/model/MMFloorObstacleLine.h +++ b/mapview/model/MMFloorObstacleLine.h @@ -63,7 +63,7 @@ public: 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) { case 0: break; } diff --git a/mapview/model/MMFloorOutlinePolygon.h b/mapview/model/MMFloorOutlinePolygon.h index 9cfb835..73578d2 100644 --- a/mapview/model/MMFloorOutlinePolygon.h +++ b/mapview/model/MMFloorOutlinePolygon.h @@ -57,7 +57,7 @@ public: 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) { case 0: fo->name = val.toString(); break; case 1: fo->outdoor = val.toBool(); break; diff --git a/mapview/model/MMFloorPOI.h b/mapview/model/MMFloorPOI.h index 5f9184c..d26ab53 100644 --- a/mapview/model/MMFloorPOI.h +++ b/mapview/model/MMFloorPOI.h @@ -44,7 +44,7 @@ public: 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) { case 0: poi->name = val.toString(); break; case 1: poi->type = (Floorplan::POIType) val.toInt(); break; diff --git a/mapview/model/MMFloorStair.h b/mapview/model/MMFloorStair.h index 6d2fcb8..c43f6c6 100644 --- a/mapview/model/MMFloorStair.h +++ b/mapview/model/MMFloorStair.h @@ -66,7 +66,7 @@ public: 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 selNode = mv2d.getSelNode(); switch(idx) { diff --git a/mapview/model/MMFloorUnderlayImage.h b/mapview/model/MMFloorUnderlayImage.h index 34eafa4..5ca8db7 100644 --- a/mapview/model/MMFloorUnderlayImage.h +++ b/mapview/model/MMFloorUnderlayImage.h @@ -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 { switch (idx) { @@ -47,6 +49,7 @@ public: case 1: return Param("scale X", ParamType::FLOAT); case 2: return Param("scale Y", ParamType::FLOAT); case 3: return Param("Anchor", ParamType::POINT2); + case 4: return Param("opacity", ParamType::FLOAT); default: throw 1; } } @@ -57,16 +60,18 @@ public: case 1: return ParamValue(img->scaleX); case 2: return ParamValue(img->scaleY); case 3: return ParamValue(img->anchor); + case 4: return ParamValue(mv2d.getOpacity()); 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) { case 0: img->filename = val.toString(); break; case 1: img->scaleX = val.toFloat(); break; case 2: img->scaleY = val.toFloat(); break; case 3: img->anchor = val.toPoint2(); break; + case 4: mv2d.setOpacity(val.toFloat()); break; default: throw 1; } }