comparison layer/Colour3DPlotLayer.h @ 1469:11a150e65ee1 by-id

Some work on updating layers for ModelId bits
author Chris Cannam
date Thu, 27 Jun 2019 13:16:25 +0100
parents 39f1154c0e97
children 886c1cd48f9d
comparison
equal deleted inserted replaced
1468:de41a11cabc2 1469:11a150e65ee1
44 44
45 public: 45 public:
46 Colour3DPlotLayer(); 46 Colour3DPlotLayer();
47 ~Colour3DPlotLayer(); 47 ~Colour3DPlotLayer();
48 48
49 const ZoomConstraint *getZoomConstraint() const override { 49 ModelId getModel() const override { return m_model; }
50 return m_model ? m_model->getZoomConstraint() : 0; 50
51 } 51 const ZoomConstraint *getZoomConstraint() const override;
52 const Model *getModel() const override { return m_model; } 52
53 void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override; 53 void paint(LayerGeometryProvider *v,
54 QPainter &paint, QRect rect) const override;
54 void setSynchronousPainting(bool synchronous) override; 55 void setSynchronousPainting(bool synchronous) override;
55 56
56 int getVerticalScaleWidth(LayerGeometryProvider *v, bool, QPainter &) const override; 57 int getVerticalScaleWidth(LayerGeometryProvider *v,
57 void paintVerticalScale(LayerGeometryProvider *v, bool, QPainter &paint, QRect rect) const override; 58 bool, QPainter &) const override;
58 59 void paintVerticalScale(LayerGeometryProvider *v,
59 QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const override; 60 bool, QPainter &paint, QRect rect) const override;
61
62 QString getFeatureDescription(LayerGeometryProvider *v,
63 QPoint &) const override;
60 64
61 bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, 65 bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame,
62 int &resolution, 66 int &resolution,
63 SnapType snap) const override; 67 SnapType snap) const override;
64 68
65 void setLayerDormant(const LayerGeometryProvider *v, bool dormant) override; 69 void setLayerDormant(const LayerGeometryProvider *v,
70 bool dormant) override;
66 71
67 bool isLayerScrollable(const LayerGeometryProvider *v) const override; 72 bool isLayerScrollable(const LayerGeometryProvider *v) const override;
68 73
69 ColourSignificance getLayerColourSignificance() const override { 74 ColourSignificance getLayerColourSignificance() const override {
70 return ColourHasMeaningfulValue; 75 return ColourHasMeaningfulValue;
71 } 76 }
72 77
73 void setModel(const DenseThreeDimensionalModel *model); 78 void setModel(ModelId model); // a DenseThreeDimensionalModel
74 79
75 int getCompletion(LayerGeometryProvider *) const override { return m_model->getCompletion(); } 80 int getCompletion(LayerGeometryProvider *) const override;
76 81
77 PropertyList getProperties() const override; 82 PropertyList getProperties() const override;
78 PropertyType getPropertyType(const PropertyName &) const override; 83 PropertyType getPropertyType(const PropertyName &) const override;
79 QString getPropertyLabel(const PropertyName &) const override; 84 QString getPropertyLabel(const PropertyName &) const override;
80 QString getPropertyIconName(const PropertyName &) const override; 85 QString getPropertyIconName(const PropertyName &) const override;
81 QString getPropertyGroupName(const PropertyName &) const override; 86 QString getPropertyGroupName(const PropertyName &) const override;
82 int getPropertyRangeAndValue(const PropertyName &, 87 int getPropertyRangeAndValue(const PropertyName &,
83 int *min, int *max, int *deflt) const override; 88 int *min, int *max, int *deflt) const override;
84 QString getPropertyValueLabel(const PropertyName &, 89 QString getPropertyValueLabel(const PropertyName &,
85 int value) const override; 90 int value) const override;
86 QString getPropertyValueIconName(const PropertyName &, 91 QString getPropertyValueIconName(const PropertyName &,
87 int value) const override; 92 int value) const override;
88 RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const override; 93 RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const override;
89 void setProperty(const PropertyName &, int value) override; 94 void setProperty(const PropertyName &, int value) override;
90 void setProperties(const QXmlAttributes &) override; 95 void setProperties(const QXmlAttributes &) override;
91 96
92 void setColourScale(ColourScaleType); 97 void setColourScale(ColourScaleType);
130 bool getSmooth() const; 135 bool getSmooth() const;
131 136
132 bool hasLightBackground() const override; 137 bool hasLightBackground() const override;
133 138
134 bool getValueExtents(double &min, double &max, 139 bool getValueExtents(double &min, double &max,
135 bool &logarithmic, QString &unit) const override; 140 bool &logarithmic, QString &unit) const override;
136 141
137 bool getDisplayExtents(double &min, double &max) const override; 142 bool getDisplayExtents(double &min, double &max) const override;
138 bool setDisplayExtents(double min, double max) override; 143 bool setDisplayExtents(double min, double max) override;
139 144
140 bool getYScaleValue(const LayerGeometryProvider *, int /* y */, 145 bool getYScaleValue(const LayerGeometryProvider *, int /* y */,
141 double &/* value */, QString &/* unit */) const override; 146 double &/* value */, QString &/* unit */) const override;
142 147
143 int getVerticalZoomSteps(int &defaultStep) const override; 148 int getVerticalZoomSteps(int &defaultStep) const override;
144 int getCurrentVerticalZoomStep() const override; 149 int getCurrentVerticalZoomStep() const override;
145 void setVerticalZoomStep(int) override; 150 void setVerticalZoomStep(int) override;
146 RangeMapper *getNewVerticalZoomRangeMapper() const override; 151 RangeMapper *getNewVerticalZoomRangeMapper() const override;
147 152
148 const Model *getSliceableModel() const override { return m_model; } 153 ModelId getSliceableModel() const override { return m_model; }
149 154
150 void toXml(QTextStream &stream, QString indent = "", 155 void toXml(QTextStream &stream, QString indent = "",
151 QString extraAttributes = "") const override; 156 QString extraAttributes = "") const override;
152 157
153 protected slots: 158 protected slots:
154 void handleModelChanged(); 159 void handleModelChanged();
155 void handleModelChangedWithin(sv_frame_t, sv_frame_t); 160 void handleModelChangedWithin(sv_frame_t, sv_frame_t);
156 161
157 protected: 162 protected:
158 const DenseThreeDimensionalModel *m_model; // I do not own this 163 ModelId m_model; // A DenseThreeDimensionalModel
159 164
160 ColourScaleType m_colourScale; 165 ColourScaleType m_colourScale;
161 bool m_colourScaleSet; 166 bool m_colourScaleSet;
162 int m_colourMap; 167 int m_colourMap;
163 bool m_colourInverted; 168 bool m_colourInverted;
182 static std::pair<ColumnNormalization, bool> convertToColumnNorm(int value); 187 static std::pair<ColumnNormalization, bool> convertToColumnNorm(int value);
183 static int convertFromColumnNorm(ColumnNormalization norm, bool visible); 188 static int convertFromColumnNorm(ColumnNormalization norm, bool visible);
184 189
185 mutable Dense3DModelPeakCache *m_peakCache; 190 mutable Dense3DModelPeakCache *m_peakCache;
186 const int m_peakCacheDivisor; 191 const int m_peakCacheDivisor;
192 void invalidatePeakCache();
187 Dense3DModelPeakCache *getPeakCache() const; 193 Dense3DModelPeakCache *getPeakCache() const;
188 void invalidatePeakCache();
189 194
190 typedef std::map<int, MagnitudeRange> ViewMagMap; // key is view id 195 typedef std::map<int, MagnitudeRange> ViewMagMap; // key is view id
191 mutable ViewMagMap m_viewMags; 196 mutable ViewMagMap m_viewMags;
192 mutable ViewMagMap m_lastRenderedMags; // when in normalizeVisibleArea mode 197 mutable ViewMagMap m_lastRenderedMags; // when in normalizeVisibleArea mode
193 void invalidateMagnitudes(); 198 void invalidateMagnitudes();