various fixes:

+ fix typos
+ fix const correctness
+ whitespace improvements
This commit is contained in:
wmayer
2017-06-19 17:18:16 +02:00
parent 39bf43202e
commit 989fe4028e
14 changed files with 33 additions and 34 deletions

View File

@@ -325,8 +325,8 @@ void Document::exportGraphviz(std::ostream& out) const
}
/**
* @brief addExpressionSubgraphIfNeeded Add a subgraph to the main graph if it is needed, i.e there are defined at least one expression in hte
* document object, or other objects are referencing properties in it.
* @brief addExpressionSubgraphIfNeeded Add a subgraph to the main graph if it is needed, i.e. there are defined at least one
* expression in the document object, or other objects are referencing properties in it.
* @param obj DocumentObject to assess.
* @param CSSubgraphs Boolean if the GeoFeatureGroups are created as subgraphs
*/
@@ -370,8 +370,9 @@ void Document::exportGraphviz(std::ostream& out) const
auto graph2 = group ? GraphList[group] : &DepList;
GraphList[o] = &graph2->create_subgraph();
}
else
else {
GraphList[o] = &graph->create_subgraph();
}
setGraphAttributes(o);
}
@@ -394,7 +395,7 @@ void Document::exportGraphviz(std::ostream& out) const
if(std::find(objects.begin(), objects.end(), docObj) != objects.end())
return;
//find the correct graph to add the vertex too. Check first expressions graphs, afterwards
//find the correct graph to add the vertex to. Check first expression graphs, afterwards
//the parent CS and origin graphs
Graph * sgraph = GraphList[docObj];
if(CSSubgraphs) {
@@ -868,12 +869,11 @@ bool Document::redo(void)
return false;
}
bool Document::performsTransactionOperation() {
bool Document::isPerformingTransaction() const
{
return d->undoing || d->rollback;
}
std::vector<std::string> Document::getAvailableUndoNames() const
{
std::vector<std::string> vList;

View File

@@ -307,7 +307,7 @@ public:
/// Will REDO one step, returns False if no redo was done (Redos == 0).
bool redo() ;
/// returns true if the document is in an Transaction phase, e.g. currently performing a redo/undo or rollback
bool performsTransactionOperation();
bool isPerformingTransaction() const;
//@}
/** @name dependency stuff */

View File

@@ -422,9 +422,9 @@ void DocumentObject::onChanged(const Property* prop)
if (prop == &Label && _pDoc && oldLabel != Label.getStrValue())
_pDoc->signalRelabelObject(*this);
// set object touched if it is a input ptoperty
// set object touched if it is an input property
if (!(prop->getType() & Prop_Output))
StatusBits.set(0);
StatusBits.set(ObjectStatus::Touch);
//call the parent for appropriate handling
TransactionalObject::onChanged(prop);

View File

@@ -56,7 +56,7 @@ void GeoFeature::transformPlacement(const Base::Placement &transform)
this->Placement.setValue(plm);
}
Base::Placement GeoFeature::globalPlacement()
Base::Placement GeoFeature::globalPlacement() const
{
auto* group = GeoFeatureGroupExtension::getGroupOfObject(this);
if(group) {

View File

@@ -72,14 +72,14 @@ public:
*
* In FreeCAD the GeoFeature placement describes the local placement of the object in its parent
* coordinate system. This is however not always the same as the global reference system. If the
* object is in a GeoFeatureGroup, hence in annother local coordinate system, the Placement
* object is in a GeoFeatureGroup, hence in another local coordinate system, the Placement
* property does only give the local transformation. This function can be used to calculate the
* placement of the object in the global reference coordinate system taking all stacked local
* system into account.
* systems into account.
*
* @return Base::Placement The transformation from the global reference coordinate system
*/
Base::Placement globalPlacement();
Base::Placement globalPlacement() const;
};
} //namespace App

View File

@@ -89,9 +89,9 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject*
if(obj->isDerivedFrom(App::OriginFeature::getClassTypeId()))
return OriginGroupExtension::getGroupOfObject(obj);
//compared to GroupExtension we do return here all geofeaturegroups including all extensions erived from it
//like origingroup. That is needed as we use this function to get all local coordinate systems. Also there
//is no reason to distuinguish between geofeatuergroups, there is only between group/geofeaturegroup
//compared to GroupExtension we do return here all GeoFeatureGroups including all extensions derived from it
//like OriginGroup. That is needed as we use this function to get all local coordinate systems. Also there
//is no reason to distinguish between GeoFeatuerGroups, there is only between group/geofeaturegroup
auto list = obj->getInList();
for (auto obj : list) {
if(obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()))
@@ -213,7 +213,7 @@ void GeoFeatureGroupExtension::getCSOutList(App::DocumentObject* obj, std::vecto
if(!obj)
return;
//if the object is a geofeaturegroup than all dependencies belong to that CS, we don't want them
//if the object is a GeoFeatureGroup then all dependencies belong to that CS, we don't want them
if(obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()))
return;

View File

@@ -38,7 +38,7 @@ namespace App
*
* This class is the FreeCAD way of representing local coordinate systems. It groups its childs beneath
* it and transforms them all with the GeoFeatureGroup placement. A few important properties:
* - Every child that belongs to the CS must be in the Group proeprty. Even if a sketch is part of a pad,
* - Every child that belongs to the CS must be in the Group property. Even if a sketch is part of a pad,
* it must be in the Group property of the same GeoFeatureGroup as pad. This also holds for normal
* GroupExtensions. They can be added to a GeoFeatureGroup, but all objects that the group holds must
* also be added to the GeoFeatureGroup
@@ -97,13 +97,13 @@ public:
virtual std::vector< DocumentObject* > addObjects(std::vector< DocumentObject* > obj) override;
virtual std::vector< DocumentObject* > removeObjects(std::vector< DocumentObject* > obj) override;
/// Collects GeoFeatureGroup relevant objects that are linked from the given one. That meas all linked objects
/// including their linkes (recursively) except GeoFeatureGroups, where the recursion stops. Expressions
/// links are ignored. A exception is thrown when there are dependency loops.
/// Collects GeoFeatureGroup relevant objects that are linked from the given one. That means all linked objects
/// including their links (recursively) except GeoFeatureGroups, where the recursion stops. Expressions
/// links are ignored. An exception is thrown when there are dependency loops.
static void getCSOutList(App::DocumentObject* obj, std::vector<App::DocumentObject*>& vec);
/// Collects GeoFeatureGroup relevant objects that link to the given one. That meas all objects
/// Collects GeoFeatureGroup relevant objects that link to the given one. That means all objects
/// including their parents (recursively) except GeoFeatureGroups, where the recursion stops. Expression
/// links are ignored. A exception is thrown when there are dependency loops.
/// links are ignored. An exception is thrown when there are dependency loops.
static void getCSInList(App::DocumentObject* obj, std::vector<App::DocumentObject*>& vec);
/// Collects all links that are relevant for the coordinate system, meaning all recursive links to
/// obj and from obj excluding expressions and stopping the recursion at other geofeaturegroups.

View File

@@ -88,7 +88,7 @@ std::vector< DocumentObject* > GroupExtension::addObjects(std::vector< DocumentO
auto geogrp = GeoFeatureGroupExtension::getGroupOfObject(getExtendedObject());
auto objgrp = GeoFeatureGroupExtension::getGroupOfObject(obj);
if( geogrp != objgrp ) {
//what to doo depends on if we are in geofeature group or not
//what to do depends on if we are in geofeature group or not
if(geogrp)
geogrp->getExtensionByType<GeoFeatureGroupExtension>()->addObject(obj);
else
@@ -133,7 +133,6 @@ std::vector< DocumentObject* > GroupExtension::removeObjects(std::vector< Docume
return removed;
}
void GroupExtension::removeObjectsFromDocument()
{
const std::vector<DocumentObject*> & grp = Group.getValues();
@@ -233,7 +232,7 @@ int GroupExtension::countObjectsOfType(const Base::Type& typeId) const
DocumentObject* GroupExtension::getGroupOfObject(const DocumentObject* obj)
{
//note that we return here only Groups, but nothing derived from it, e.g. no GeoFeatureGroups.
//That is important as there are clear differences between groups/geofeature groups (e.g. a object
//That is important as there are clear differences between groups/geofeature groups (e.g. an object
//can be in only one group, and only one geofeaturegroup, however, it can be in both at the same time)
auto list = obj->getInList();
for (auto obj : list) {

View File

@@ -96,7 +96,7 @@ public:
/** Returns the object group of the document which the given object \a obj is part of.
* In case this object is not part of a group 0 is returned.
* @note This only returns objects that are normal groups, not any special derived type
* like geofeaturegroups or origingroups. To retrieve those please youse their appropriate functions
* like GeoFeatureGroups or OriginGroups. To retrieve those please use their appropriate functions
*/
static DocumentObject* getGroupOfObject(const DocumentObject* obj);
//@}

View File

@@ -72,7 +72,7 @@ std::vector<App::DocumentObject*> ViewProviderGeoFeatureGroupExtension::extensio
//like pad/sketch
auto* ext = getExtendedViewProvider()->getObject()->getExtensionByType<App::GeoFeatureGroupExtension>();
if(ext) {
//filter out all objects with more than one inlink, as they are most likely hold by annother
//filter out all objects with more than one inlink, as they are most likely hold by another
//object in the tree
std::vector<App::DocumentObject*> claim;
auto objs = ext->Group.getValues();

View File

@@ -96,7 +96,6 @@ void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) {
App::DocumentObject* grp = static_cast<App::DocumentObject*>(getExtendedViewProvider()->getObject());
App::Document* doc = grp->getDocument();
Gui::Document* gui = Gui::Application::Instance->getDocument(doc);
// build Python command for execution
QString cmd;

View File

@@ -70,7 +70,9 @@ public:
void resetTemporaryVisibility ();
///@}
virtual bool canDragObjects() const {return false;};
virtual bool canDragObjects() const {
return false;
}
/// Returns default size. Use this if it is not possible to determine appropriate size by other means
static double defaultSize() {return 10.;}

View File

@@ -614,7 +614,7 @@ CmdPartDesignMoveFeature::CmdPartDesignMoveFeature()
}
void CmdPartDesignMoveFeature::activated(int iMsg)
{
{
Q_UNUSED(iMsg);
std::vector<App::DocumentObject*> features = getSelection().getObjectsOfType(Part::Feature::getClassTypeId());
if (features.empty()) return;

View File

@@ -5823,5 +5823,4 @@ void ViewProviderSketch::showRestoreInformationLayer() {
visibleInformationChanged = true ;
draw(false,false);
}
}