App: Fix header uniformity, trailing whitespace, and doxygen headers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
|
||||
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
@@ -55,9 +55,9 @@ LinkBaseExtension::LinkBaseExtension(void)
|
||||
:myOwner(0),enableLabelCache(false),hasOldSubElement(false)
|
||||
{
|
||||
initExtensionType(LinkBaseExtension::getExtensionClassTypeId());
|
||||
EXTENSION_ADD_PROPERTY_TYPE(_LinkTouched, (false), " Link",
|
||||
EXTENSION_ADD_PROPERTY_TYPE(_LinkTouched, (false), " Link",
|
||||
PropertyType(Prop_Hidden|Prop_NoPersist),0);
|
||||
EXTENSION_ADD_PROPERTY_TYPE(_ChildCache, (), " Link",
|
||||
EXTENSION_ADD_PROPERTY_TYPE(_ChildCache, (), " Link",
|
||||
PropertyType(Prop_Hidden|Prop_NoPersist|Prop_ReadOnly),0);
|
||||
_ChildCache.setScope(LinkScope::Global);
|
||||
props.resize(PropMax,0);
|
||||
@@ -87,7 +87,7 @@ const LinkBaseExtension::PropInfoMap &LinkBaseExtension::getPropertyInfoMap() co
|
||||
static PropInfoMap PropsMap;
|
||||
if(PropsMap.empty()) {
|
||||
const auto &infos = getPropertyInfo();
|
||||
for(const auto &info : infos)
|
||||
for(const auto &info : infos)
|
||||
PropsMap[info.name] = info;
|
||||
}
|
||||
return PropsMap;
|
||||
@@ -116,12 +116,12 @@ void LinkBaseExtension::setProperty(int idx, Property *prop) {
|
||||
props[idx]->setStatus(Property::LockDynamic,false);
|
||||
props[idx] = 0;
|
||||
}
|
||||
if(!prop)
|
||||
if(!prop)
|
||||
return;
|
||||
if(!prop->isDerivedFrom(infos[idx].type)) {
|
||||
std::ostringstream str;
|
||||
str << "App::LinkBaseExtension: expected property type '" <<
|
||||
infos[idx].type.getName() << "', instead of '" <<
|
||||
str << "App::LinkBaseExtension: expected property type '" <<
|
||||
infos[idx].type.getName() << "', instead of '" <<
|
||||
prop->getClassTypeId().getName() << "'";
|
||||
LINK_THROW(Base::TypeError,str.str().c_str());
|
||||
}
|
||||
@@ -166,13 +166,13 @@ void LinkBaseExtension::setProperty(int idx, Property *prop) {
|
||||
|
||||
if(FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_TRACE)) {
|
||||
const char *propName;
|
||||
if(!prop)
|
||||
if(!prop)
|
||||
propName = "<null>";
|
||||
else if(prop->getContainer())
|
||||
propName = prop->getName();
|
||||
else
|
||||
else
|
||||
propName = extensionGetPropertyName(prop);
|
||||
if(!propName)
|
||||
if(!propName)
|
||||
propName = "?";
|
||||
FC_TRACE("set property " << infos[idx].name << ": " << propName);
|
||||
}
|
||||
@@ -303,7 +303,7 @@ int LinkBaseExtension::_getElementCountValue() const {
|
||||
}
|
||||
|
||||
bool LinkBaseExtension::extensionHasChildElement() const {
|
||||
if(_getElementListValue().size()
|
||||
if(_getElementListValue().size()
|
||||
|| (_getElementCountValue() && _getShowElementValue()))
|
||||
return true;
|
||||
DocumentObject *linked = getTrueLinkedObject(false);
|
||||
@@ -318,7 +318,7 @@ int LinkBaseExtension::extensionSetElementVisible(const char *element, bool visi
|
||||
int index = _getShowElementValue()?getElementIndex(element):getArrayIndex(element);
|
||||
if(index>=0) {
|
||||
auto propElementVis = getVisibilityListProperty();
|
||||
if(!propElementVis || !element || !element[0])
|
||||
if(!propElementVis || !element || !element[0])
|
||||
return -1;
|
||||
if(propElementVis->getSize()<=index) {
|
||||
if(visible) return 1;
|
||||
@@ -381,7 +381,7 @@ DocumentObject *LinkBaseExtension::getLink(int depth) const{
|
||||
}
|
||||
|
||||
int LinkBaseExtension::getArrayIndex(const char *subname, const char **psubname) {
|
||||
if(!subname || Data::ComplexGeoData::isMappedElement(subname))
|
||||
if(!subname || Data::ComplexGeoData::isMappedElement(subname))
|
||||
return -1;
|
||||
const char *dot = strchr(subname,'.');
|
||||
if(!dot) dot= subname+strlen(subname);
|
||||
@@ -401,7 +401,7 @@ int LinkBaseExtension::getArrayIndex(const char *subname, const char **psubname)
|
||||
}
|
||||
|
||||
int LinkBaseExtension::getElementIndex(const char *subname, const char **psubname) const {
|
||||
if(!subname || Data::ComplexGeoData::isMappedElement(subname))
|
||||
if(!subname || Data::ComplexGeoData::isMappedElement(subname))
|
||||
return -1;
|
||||
int idx = -1;
|
||||
const char *dot = strchr(subname,'.');
|
||||
@@ -414,7 +414,7 @@ int LinkBaseExtension::getElementIndex(const char *subname, const char **psubnam
|
||||
if(_getElementCountProperty()) {
|
||||
if(idx>=_getElementCountValue())
|
||||
return -1;
|
||||
}else if(idx>=(int)_getElementListValue().size())
|
||||
}else if(idx>=(int)_getElementListValue().size())
|
||||
return -1;
|
||||
}else if(!_getShowElementValue() && _getElementCountValue()) {
|
||||
// If elements are collapsed, we check first for LinkElement naming
|
||||
@@ -579,8 +579,8 @@ bool LinkBaseExtension::extensionGetSubObjects(std::vector<std::string> &ret, in
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LinkBaseExtension::extensionGetSubObject(DocumentObject *&ret, const char *subname,
|
||||
PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const
|
||||
bool LinkBaseExtension::extensionGetSubObject(DocumentObject *&ret, const char *subname,
|
||||
PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const
|
||||
{
|
||||
ret = 0;
|
||||
auto obj = getContainer();
|
||||
@@ -605,8 +605,8 @@ bool LinkBaseExtension::extensionGetSubObject(DocumentObject *&ret, const char *
|
||||
_mat = *mat;
|
||||
}
|
||||
|
||||
if(pyObj && !_getElementCountValue()
|
||||
&& _getElementListValue().empty() && mySubElements.size()<=1)
|
||||
if(pyObj && !_getElementCountValue()
|
||||
&& _getElementListValue().empty() && mySubElements.size()<=1)
|
||||
{
|
||||
// Scale will be included here
|
||||
if(getScaleProperty() || getScaleVectorProperty()) {
|
||||
@@ -659,7 +659,7 @@ bool LinkBaseExtension::extensionGetSubObject(DocumentObject *&ret, const char *
|
||||
}
|
||||
|
||||
auto linked = getTrueLinkedObject(false,mat,depth);
|
||||
if(!linked || linked==obj)
|
||||
if(!linked || linked==obj)
|
||||
return true;
|
||||
|
||||
Base::Matrix4D matNext;
|
||||
@@ -692,13 +692,13 @@ bool LinkBaseExtension::extensionGetSubObject(DocumentObject *&ret, const char *
|
||||
return true;
|
||||
}
|
||||
|
||||
void LinkBaseExtension::checkGeoElementMap(const App::DocumentObject *obj,
|
||||
void LinkBaseExtension::checkGeoElementMap(const App::DocumentObject *obj,
|
||||
const App::DocumentObject *linked, PyObject **pyObj, const char *postfix) const
|
||||
{
|
||||
if(!pyObj || !*pyObj || (!postfix && obj->getDocument()==linked->getDocument()) ||
|
||||
!PyObject_TypeCheck(*pyObj, &Data::ComplexGeoDataPy::Type))
|
||||
return;
|
||||
|
||||
|
||||
// auto geoData = static_cast<Data::ComplexGeoDataPy*>(*pyObj)->getComplexGeoDataPtr();
|
||||
// geoData->reTagElementMap(obj->getID(),obj->getDocument()->Hasher,postfix);
|
||||
}
|
||||
@@ -708,14 +708,14 @@ void LinkBaseExtension::onExtendedUnsetupObject() {
|
||||
return;
|
||||
auto objs = getElementListValue();
|
||||
getElementListProperty()->setValue();
|
||||
for(auto obj : objs)
|
||||
for(auto obj : objs)
|
||||
detachElement(obj);
|
||||
}
|
||||
|
||||
DocumentObject *LinkBaseExtension::getTrueLinkedObject(
|
||||
bool recurse, Base::Matrix4D *mat, int depth, bool noElement) const
|
||||
{
|
||||
if(noElement && extensionIsDerivedFrom(LinkElement::getExtensionClassTypeId())
|
||||
if(noElement && extensionIsDerivedFrom(LinkElement::getExtensionClassTypeId())
|
||||
&& !static_cast<const LinkElement*>(this)->canDelete())
|
||||
{
|
||||
return 0;
|
||||
@@ -736,10 +736,10 @@ DocumentObject *LinkBaseExtension::getTrueLinkedObject(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool LinkBaseExtension::extensionGetLinkedObject(DocumentObject *&ret,
|
||||
bool LinkBaseExtension::extensionGetLinkedObject(DocumentObject *&ret,
|
||||
bool recurse, Base::Matrix4D *mat, bool transform, int depth) const
|
||||
{
|
||||
if(mat)
|
||||
if(mat)
|
||||
*mat *= getTransform(transform);
|
||||
ret = 0;
|
||||
if(!_getElementCountValue())
|
||||
@@ -822,7 +822,7 @@ void LinkBaseExtension::updateGroup() {
|
||||
auto group = ext->getExtendedObject();
|
||||
auto &conn = plainGroupConns[group];
|
||||
if(!conn.connected()) {
|
||||
FC_LOG("new group connection " << getExtendedObject()->getFullName()
|
||||
FC_LOG("new group connection " << getExtendedObject()->getFullName()
|
||||
<< " -> " << group->getFullName());
|
||||
conn = group->signalChanged.connect(
|
||||
boost::bind(&LinkBaseExtension::slotChangedPlainGroup,this,bp::_1,bp::_2));
|
||||
@@ -836,7 +836,7 @@ void LinkBaseExtension::updateGroup() {
|
||||
groupSet.insert(child);
|
||||
auto &conn = plainGroupConns[child];
|
||||
if(!conn.connected()) {
|
||||
FC_LOG("new group connection " << getExtendedObject()->getFullName()
|
||||
FC_LOG("new group connection " << getExtendedObject()->getFullName()
|
||||
<< " -> " << child->getFullName());
|
||||
conn = child->signalChanged.connect(
|
||||
boost::bind(&LinkBaseExtension::slotChangedPlainGroup,this,bp::_1,bp::_2));
|
||||
@@ -885,7 +885,7 @@ void LinkBaseExtension::update(App::DocumentObject *parent, const Property *prop
|
||||
}
|
||||
}
|
||||
}else if(prop == _getShowElementProperty()) {
|
||||
if(_getShowElementValue())
|
||||
if(_getShowElementValue())
|
||||
update(parent,_getElementCountProperty());
|
||||
else {
|
||||
auto objs = getElementListValue();
|
||||
@@ -1001,7 +1001,7 @@ void LinkBaseExtension::update(App::DocumentObject *parent, const Property *prop
|
||||
obj->Scale.setValue(1);
|
||||
objs.push_back(obj);
|
||||
}
|
||||
if(getPlacementListProperty())
|
||||
if(getPlacementListProperty())
|
||||
getPlacementListProperty()->setSize(0);
|
||||
if(getScaleListProperty())
|
||||
getScaleListProperty()->setSize(0);
|
||||
@@ -1074,9 +1074,9 @@ void LinkBaseExtension::update(App::DocumentObject *parent, const Property *prop
|
||||
}
|
||||
}
|
||||
syncElementList();
|
||||
if(_getShowElementValue()
|
||||
&& _getElementCountProperty()
|
||||
&& getElementListProperty()
|
||||
if(_getShowElementValue()
|
||||
&& _getElementCountProperty()
|
||||
&& getElementListProperty()
|
||||
&& getElementCountValue()!=getElementListProperty()->getSize())
|
||||
{
|
||||
getElementCountProperty()->setValue(
|
||||
@@ -1121,8 +1121,8 @@ void LinkBaseExtension::cacheChildLabel(int enable) const {
|
||||
}
|
||||
|
||||
bool LinkBaseExtension::linkTransform() const {
|
||||
if(!getLinkTransformProperty() &&
|
||||
!getLinkPlacementProperty() &&
|
||||
if(!getLinkTransformProperty() &&
|
||||
!getLinkPlacementProperty() &&
|
||||
!getPlacementProperty())
|
||||
return true;
|
||||
return getLinkTransformValue();
|
||||
@@ -1138,7 +1138,7 @@ void LinkBaseExtension::syncElementList() {
|
||||
auto elements = getElementListValue();
|
||||
for(size_t i=0;i<elements.size();++i) {
|
||||
auto element = freecad_dynamic_cast<LinkElement>(elements[i]);
|
||||
if(!element || (element->myOwner && element->myOwner!=ownerID))
|
||||
if(!element || (element->myOwner && element->myOwner!=ownerID))
|
||||
continue;
|
||||
|
||||
element->myOwner = ownerID;
|
||||
@@ -1175,12 +1175,12 @@ void LinkBaseExtension::onExtendedDocumentRestored() {
|
||||
// SubElements was stored as a PropertyStringList. It is now migrated to be
|
||||
// stored inside PropertyXLink.
|
||||
auto xlink = freecad_dynamic_cast<PropertyXLink>(getLinkedObjectProperty());
|
||||
if(!xlink)
|
||||
if(!xlink)
|
||||
FC_ERR("Failed to restore SubElements for " << parent->getFullName());
|
||||
else if(!xlink->getValue())
|
||||
FC_ERR("Discard SubElements of " << parent->getFullName() << " due to null link");
|
||||
else if(xlink->getSubValues().size() > 1)
|
||||
FC_ERR("Failed to restore SubElements for " << parent->getFullName()
|
||||
FC_ERR("Failed to restore SubElements for " << parent->getFullName()
|
||||
<< " due to conflict subnames");
|
||||
else if(xlink->getSubValues().empty()) {
|
||||
auto subs = xlink->getSubValues();
|
||||
@@ -1227,8 +1227,8 @@ void LinkBaseExtension::_handleChangedPropertyName(
|
||||
}
|
||||
}
|
||||
|
||||
void LinkBaseExtension::setLink(int index, DocumentObject *obj,
|
||||
const char *subname, const std::vector<std::string> &subElements)
|
||||
void LinkBaseExtension::setLink(int index, DocumentObject *obj,
|
||||
const char *subname, const std::vector<std::string> &subElements)
|
||||
{
|
||||
auto parent = getContainer();
|
||||
if(!parent)
|
||||
@@ -1316,7 +1316,7 @@ void LinkBaseExtension::setLink(int index, DocumentObject *obj,
|
||||
|
||||
auto objs = getElementListValue();
|
||||
getElementListProperty()->setValue();
|
||||
for(auto obj : objs)
|
||||
for(auto obj : objs)
|
||||
detachElement(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user