Skip to content

Commit 856e428

Browse files
committed
Cleanup previous approach
1 parent 6df1260 commit 856e428

8 files changed

Lines changed: 20 additions & 293 deletions

File tree

src/core/objects/dynamic_object_query.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ const QStringList DynamicObjectQueryManager::getContextKeywords(const QString& t
289289
}
290290
return QStringList();
291291
}
292-
return QString(QLatin1String("ISUNDEFINED; TYPE; ID; == != AND; OR;")).split(QLatin1Char(' '));
292+
return QString(QLatin1String("ISUNDEFINED; TYPE; ID; AND; OR; == !=")).split(QLatin1Char(' '));
293293

294294
case DynamicObjectQuery::GeneralObjectQuery:
295295
return QStringList{QLatin1String("IGNORESYMBOL;"), QLatin1String("ISDUPLICATE;")};

src/core/objects/object.cpp

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -77,45 +77,11 @@ namespace literal
7777
static const QLatin1String rotation("rotation");
7878
static const QLatin1String size("size");
7979
static const QLatin1String tags("tags");
80-
81-
// object properties
82-
// boolean operations
83-
static const QLatin1String UndefinedSymbol(".UndefinedSymbol");
84-
static const QLatin1String AreaTooSmall(".AreaTooSmall");
85-
static const QLatin1String LineTooShort(".LineTooShort");
86-
// comparisons
87-
static const QLatin1String PaperArea(".PaperArea");
88-
static const QLatin1String RealArea(".RealArea");
89-
static const QLatin1String PaperLength(".PaperLength");
90-
static const QLatin1String RealLength(".RealLength");
9180
}
9281

9382

9483
namespace OpenOrienteering {
9584

96-
static const std::vector<QLatin1String> object_properties = {literal::UndefinedSymbol, literal::AreaTooSmall, literal::LineTooShort,
97-
literal::PaperArea, literal::RealArea, literal::PaperLength, literal::RealLength};
98-
99-
bool Object::isObjectProperty(const QString& property)
100-
{
101-
return std::find(object_properties.begin(), object_properties.end(), property) != object_properties.end();
102-
}
103-
104-
bool Object::isBooleanObjectProperty(const QString& property)
105-
{
106-
return std::find(object_properties.begin(), object_properties.begin() + 3, property) != object_properties.begin() + 3;
107-
}
108-
109-
bool Object::isComparisonObjectProperty(const QString& property)
110-
{
111-
return std::find(object_properties.begin() + 3, object_properties.end(), property) != object_properties.end();
112-
}
113-
114-
const std::vector<QLatin1String>& Object::getObjectProperties()
115-
{
116-
return object_properties;
117-
}
118-
11985
// ### Object implementation ###
12086

12187
Object::Object(Object::Type type, const Symbol* symbol)
@@ -789,17 +755,6 @@ void Object::includeControlPointsRect(QRectF& rect) const
789755
}
790756

791757

792-
QVariant Object::getObjectProperty(const QString& property) const
793-
{
794-
if (property == literal::UndefinedSymbol)
795-
{
796-
if (map && symbol)
797-
return QVariant(map->findSymbolIndex(symbol) < 0);
798-
}
799-
800-
return QVariant();
801-
}
802-
803758

804759
// ### PathPart ###
805760

@@ -3265,32 +3220,6 @@ bool PathObject::isLineTooShort() const
32653220
}
32663221

32673222

3268-
// override
3269-
QVariant PathObject::getObjectProperty(const QString& property) const
3270-
{
3271-
if (property == literal::AreaTooSmall)
3272-
return QVariant(isAreaTooSmall());
3273-
3274-
if (property == literal::LineTooShort)
3275-
return QVariant(isLineTooShort());
3276-
3277-
if (property == literal::PaperArea)
3278-
return QVariant(calculatePaperArea());
3279-
3280-
if (property == literal::RealArea)
3281-
return QVariant(calculateRealArea());
3282-
3283-
if (property == literal::PaperLength)
3284-
return QVariant(getPaperLength());
3285-
3286-
if (property == literal::RealLength)
3287-
return QVariant(getRealLength());
3288-
3289-
return Object::getObjectProperty(property); // pass to base class function
3290-
}
3291-
3292-
3293-
32943223
// ### PointObject ###
32953224

32963225
PointObject::PointObject(const Symbol* symbol)

src/core/objects/object.h

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -318,26 +318,6 @@ friend class XMLImportExport;
318318
*/
319319
void includeControlPointsRect(QRectF& rect) const;
320320

321-
322-
/**
323-
* Returns dynamic object properties that are common for all objects.
324-
* Derived object classes (i.e., PathObject) override this function to return class specific object properties.
325-
* If derived object classes don't provide a requested property, they invoke the base class function.
326-
*/
327-
virtual QVariant getObjectProperty(const QString& property) const;
328-
329-
/** Returns true if property is a dynamic object property. */
330-
static bool isObjectProperty(const QString& property);
331-
332-
/** Returns true if property is a dynamic object property that returns a boolean value. */
333-
static bool isBooleanObjectProperty(const QString& property);
334-
335-
/** Returns true if property is a dynamic object property that returns a value for comparison. */
336-
static bool isComparisonObjectProperty(const QString& property);
337-
338-
/** Returns keywords of the available dynamic object properties. */
339-
static const std::vector<QLatin1String>& getObjectProperties();
340-
341321
protected:
342322
virtual void updateEvent() const;
343323

@@ -946,14 +926,6 @@ class PathObject : public Object // clazy:exclude=copyable-polymorphic
946926
bool isLineTooShort() const;
947927

948928

949-
/**
950-
* Returns dynamic object properties that are specific for the PathObject class.
951-
* Note: Overrides the base class function that returns dynamic object properties that are common for all objects.
952-
* If a requested property is not provided by PathObject, the base class function is invoked.
953-
*/
954-
QVariant getObjectProperty(const QString& property) const override;
955-
956-
957929
protected:
958930
/**
959931
* Adjusts the end index of the given part and the start/end indexes of the following parts.
@@ -1164,6 +1136,7 @@ struct ObjectPathCoord : public PathCoord
11641136
};
11651137

11661138

1139+
11671140
//### Object inline code ###
11681141

11691142
inline

0 commit comments

Comments
 (0)