Several enhancements

+ PLMXML Reader
+ Some meta information sorting
+ Making ProductRefs invisibly in Tree
This commit is contained in:
jriegel
2015-04-02 22:56:42 +02:00
committed by Stefan Tröger
parent 5d5c04a508
commit c88a8336dc
15 changed files with 275 additions and 65 deletions

View File

@@ -43,6 +43,8 @@ PROPERTY_SOURCE_ABSTRACT(Assembly::Item, App::GeoFeature)
Item::Item()
{
ADD_PROPERTY_TYPE(Meta, (), 0, App::Prop_None, "Map with additional meta information");
}
short Item::mustExecute() const

View File

@@ -39,7 +39,10 @@ class AssemblyExport Item : public App::GeoFeature
public:
Item();
~Item() {};
~Item() {};
/// Meta descriptons
App::PropertyMap Meta;
/** @name methods override feature */
//@{

View File

@@ -45,13 +45,6 @@ PROPERTY_SOURCE(Assembly::Product, Assembly::Item)
Product::Product() {
ADD_PROPERTY(Items,(0));
ADD_PROPERTY_TYPE(CreatedBy,(""),0,App::Prop_None,"The creator of the Item");
ADD_PROPERTY_TYPE(CreationDate,(Base::TimeInfo::currentDateTimeString()),0,App::Prop_ReadOnly,"Date of creation");
ADD_PROPERTY_TYPE(LastModifiedBy,(""),0,App::Prop_None,0);
ADD_PROPERTY_TYPE(LastModifiedDate,("Unknown"),0,App::Prop_ReadOnly,"Date of last modification");
ADD_PROPERTY_TYPE(Company,(""),0,App::Prop_None,"Additional tag to save the the name of the company");
ADD_PROPERTY_TYPE(Comment,(""),0,App::Prop_None,"Additional tag to save a comment");
ADD_PROPERTY_TYPE(Meta,(),0,App::Prop_None,"Map with additional meta information");
ADD_PROPERTY_TYPE(Material,(),0,App::Prop_None,"Map with material properties");
// create the uuid for the document
Base::Uuid id;

View File

@@ -52,29 +52,16 @@ public:
App::PropertyString Id;
/// unique identifier of the Item
App::PropertyUUID Uid;
/// long description of the Item
App::PropertyString Description ;
/// creators name (utf-8)
App::PropertyString CreatedBy;
App::PropertyString CreationDate;
/// user last modified the document
App::PropertyString LastModifiedBy;
App::PropertyString LastModifiedDate;
/// company name UTF8(optional)
App::PropertyString Company;
/// long comment or description (UTF8 with line breaks)
App::PropertyString Comment;
/// material descriptons
App::PropertyMap Material;
/** License string
* Holds the short license string for the Item, e.g. CC-BY
* for the Creative Commons license suit.
*/
* Holds the short license string for the Item, e.g. CC-BY
* for the Creative Commons license suit.
*/
App::PropertyString License;
/// License descripton/contract URL
App::PropertyString LicenseURL;
/// Meta descriptons
App::PropertyMap Meta;
/// Meta descriptons
App::PropertyMap Material;
//@}
/** @name Visual properties */

View File

@@ -35,7 +35,7 @@
#include <Gui/Application.h>
#include <Mod/Assembly/App/Product.h>
#include <Mod/Assembly/App/PartRef.h>
#include <Mod/Assembly/App/ProductRef.h>
//#include <Mod/Part/App/BodyBase.h>
using namespace AssemblyGui;
@@ -94,9 +94,26 @@ std::vector<std::string> ViewProviderProduct::getDisplayModes(void) const
std::vector<App::DocumentObject*> ViewProviderProduct::claimChildren(void)const
{
std::vector<App::DocumentObject*> temp(static_cast<Assembly::Product*>(getObject())->Items.getValues());
return temp;
std::vector<App::DocumentObject*> returnVector;
// do not adopt the ref-objects as child, rather use the target objects if any
// that makes the ProductRefs invisibly in the tree!
const std::vector<App::DocumentObject*> &items = static_cast<Assembly::Product*>(getObject())->Items.getValues();
for (std::vector<App::DocumentObject*>::const_iterator it = items.begin(); it != items.end(); ++it)
{
if ((*it)->getTypeId() == Assembly::ProductRef::getClassTypeId())
{
App::DocumentObject *obj = static_cast<Assembly::ProductRef *> (*it)->Item.getValue();
if (obj)
{
returnVector.push_back(obj);
}
}
}
return returnVector;
}
std::vector<App::DocumentObject*> ViewProviderProduct::claimChildren3D(void)const

View File

@@ -94,9 +94,15 @@ std::vector<std::string> ViewProviderProductRef::getDisplayModes(void) const
std::vector<App::DocumentObject*> ViewProviderProductRef::claimChildren(void)const
{
App::DocumentObject * obj = static_cast<Assembly::ProductRef*>(getObject())->Item.getValue();
if (obj){
std::vector<App::DocumentObject*> ret(1);
ret[0] = static_cast<Assembly::ProductRef*>(getObject())->Item.getValue();
ret[0] = obj;
return ret;
}
else{
return std::vector<App::DocumentObject*>();
}
}
std::vector<App::DocumentObject*> ViewProviderProductRef::claimChildren3D(void)const

View File

@@ -50,6 +50,10 @@ public:
virtual std::vector<App::DocumentObject*> claimChildren(void)const;
virtual std::vector<App::DocumentObject*> claimChildren3D(void)const;
virtual bool showInTree() const
{
return false;
}
virtual void setupContextMenu(QMenu* menu, QObject* receiver, const char* member);
virtual bool setEdit(int ModNum);