]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/WorkspaceIO.cxx
More on graph editor
[cpPlugins.git] / lib / cpPlugins / Interface / WorkspaceIO.cxx
index d1578ba12818ddb9a3070f113587fcffc473ae98..ce81b8639ff7089b188e6953ce1bb255dcabf8cf 100644 (file)
@@ -14,51 +14,25 @@ LoadWorkspace( const std::string& fname )
     return( "cpPlugins::Interface::Workspace: No valid workspace" );
   std::stringstream err;
 
-  // Read plugins files
-  TiXmlElement* plugins = root->FirstChildElement( "plugins" );
-  while( plugins != NULL )
-  {
-    const char* value = plugins->Attribute( "filename" );
-    if( value != NULL )
-    {
-      if( !( this->LoadPlugins( value ) ) )
-        err << "no valid plugins file \"" << value << "\"" << std::endl;
-
-    } // fi
-    plugins = plugins->NextSiblingElement( "plugins" );
-
-  } // elihw
-
-  // Read plugins paths
-  plugins = root->FirstChildElement( "plugins_dir" );
-  while( plugins != NULL )
-  {
-    const char* value = plugins->Attribute( "path" );
-    if( value != NULL )
-    {
-      int recursive;
-      if( plugins->QueryIntAttribute( "recursive", &recursive ) != TIXML_SUCCESS )
-        recursive = 0;
-      if( !( this->LoadPluginsPath( value, recursive == 1 ) ) )
-        err << "No valid plugins path \"" << value << "\"" << std::endl;
-
-    } // fi
-    plugins = plugins->NextSiblingElement( "plugins_dir" );
-
-  } // elihw
-
   // Read filters
   TiXmlElement* filter = root->FirstChildElement( "filter" );
   while( filter != NULL )
   {
     const char* class_value = filter->Attribute( "class" );
     const char* name_value = filter->Attribute( "name" );
+    float viewX = float( 0 );
+    float viewY = float( 0 );
+    filter->QueryFloatAttribute( "ViewX", &viewX );
+    filter->QueryFloatAttribute( "ViewY", &viewY );
     if( class_value != NULL && name_value != NULL )
     {
       if( this->CreateFilter( class_value, name_value ) )
       {
+        TFilter* new_filter = this->GetFilter( name_value );
+        new_filter->SetViewCoords( viewX, viewY );
+
         // Read parameters
-        TParameters* parameters = this->GetParameters( name_value );
+        TParameters* parameters = new_filter->GetParameters( );
         parameters->Clear( );
 
         TiXmlElement* param = filter->FirstChildElement( "parameter" );
@@ -162,19 +136,6 @@ SaveWorkspace( const std::string& fname ) const
   TiXmlDocument* doc = new TiXmlDocument( );
   TiXmlElement* root = new TiXmlElement( "cpPlugins_Workspace" );
 
-  // Save plugins
-  for(
-    auto plugIt = this->m_LoadedPlugins.begin( );
-    plugIt != this->m_LoadedPlugins.end( );
-    ++plugIt
-    )
-  {
-    TiXmlElement* plugin = new TiXmlElement( "plugins" );
-    plugin->SetAttribute( "filename", plugIt->c_str( ) );
-    root->LinkEndChild( plugin );
-
-  } // rof
-
   // Save vertices
   auto vIt = this->m_Graph->BeginVertices( );
   for( ; vIt != this->m_Graph->EndVertices( ); ++vIt )
@@ -184,8 +145,10 @@ SaveWorkspace( const std::string& fname ) const
     if( filter != NULL )
     {
       TiXmlElement* e = new TiXmlElement( "filter" );
-      e->SetAttribute( "class", filter->GetClassName( ).c_str( ) );
+      e->SetAttribute( "class", filter->GetClassName( ) );
       e->SetAttribute( "name", filter->GetName( ) );
+      e->SetAttribute( "ViewX", filter->GetViewX( ) );
+      e->SetAttribute( "ViewY", filter->GetViewY( ) );
 
       const TParameters* params = filter->GetParameters( );
       std::vector< std::string > names;