Salome HOME
Copyright update 2021
[samples/sierpinsky.git] / src / Sierpinsky / SIERPINSKY_Gen_i.cxx
index 6f62bb404ba5cb86acfe92e9185e7bf9b8a27e0e..3a768d355f5d2c11e230caea31ee9052a26bd1a9 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2005-2013  OPEN CASCADE
+// Copyright (C) 2005-2021  OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // Author  : Vadim SANDLER (OCN)
 // Created : 13/07/05
 ///////////////////////////////////////////////////////////
-//
 
 #include "SIERPINSKY_Gen_i.hxx"
 #include "SIERPINSKY_version.h"
 #include <MED_Factory.hxx>
-#ifndef WIN32
+#ifdef WITH_LIBGD
 #include <gd.h>
-#endif
+#endif // WITH_LIBGD
 
 /*!
  * Engine factory
  */
 extern "C"
-{
+{ 
+  SIERPINSKYENGINE_EXPORT
   PortableServer::ObjectId * SIERPINSKYEngine_factory( CORBA::ORB_ptr            orb,
                                                        PortableServer::POA_ptr   poa, 
                                                        PortableServer::ObjectId* contId,
@@ -122,7 +122,7 @@ void SIERPINSKY_Gen_i::NextPoint( CORBA::Double  theX,     CORBA::Double  theY,
  */
 CORBA::Boolean SIERPINSKY_Gen_i::ExportToJPEG( const char* theFileName, CORBA::Long theSize )
 {
-#ifndef WIN32
+#ifdef WITH_LIBGD
   if ( theSize <= 0 ) return false;
 
   // open file
@@ -148,10 +148,10 @@ CORBA::Boolean SIERPINSKY_Gen_i::ExportToJPEG( const char* theFileName, CORBA::L
   gdImageDestroy( image );
   
   return true;
-#else
-  printf("Warning: ExportToJPEG() is not supported on Windows!");
+#else // WITH_LIBGD
+  printf("Warning: ExportToJPEG() is not supported (libgd is required)!");
   return false;
-#endif
+#endif // WITH_LIBGD
 }
   
 /*!
@@ -169,7 +169,7 @@ CORBA::Boolean SIERPINSKY_Gen_i::ExportToMED( const char* theFileName, CORBA::Do
   }
   
   // create MED 2.2 file
-  MED::PWrapper aMed = MED::CrWrapper( theFileName, MED::eV2_2 );
+  MED::PWrapper aMed = MED::CrWrapperW( theFileName );
 
   // create 2D mesh
   MED::PMeshInfo aMesh = aMed->CrMeshInfo( 2, 2, "Sierpinsky" );