]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
import image: add documentation and improve image rendering
authorrraphael <raphael.raphael@c-s.fr>
Thu, 10 Dec 2020 16:34:20 +0000 (17:34 +0100)
committerrraphael <raphael.raphael@c-s.fr>
Fri, 15 Jan 2021 11:10:10 +0000 (12:10 +0100)
src/ExchangePlugin/doc/images/imageImported.png [new file with mode: 0644]
src/ExchangePlugin/doc/importFeature.rst
src/PartSet/PartSet_Module.cpp

diff --git a/src/ExchangePlugin/doc/images/imageImported.png b/src/ExchangePlugin/doc/images/imageImported.png
new file mode 100644 (file)
index 0000000..a32892e
Binary files /dev/null and b/src/ExchangePlugin/doc/images/imageImported.png differ
index 64251ddb201f420994deb9fbd75d9d882ad5f98b..c939ae31d3393222d4af5c74a9a55b9272d95c26 100644 (file)
@@ -57,7 +57,7 @@ The import will be performed within the active part. If no part is active, the p
 Import from CAD formats
 -----------------------
 
-It is possible to import files in the following CAD-neutral formats: BREP, STEP, IGES, XAO.
+It is possible to import files in the following CAD-neutral formats: BREP, STEP, IGES, XAO, STL.
 To import a file into active part select in the Main Menu *File -> Import -> From CAD format...* item.
 
 The following property panel will be opened:
@@ -103,6 +103,20 @@ The Result of the operation depends on the imported file content.
 
    Import of BREP file.
 
+Import pictures
+-----------------------
+
+It is possible to import pictures in the following image formats: GIF, TIFF, PNG, JPG, JPEG, BMP, PPM, JPE.
+To import a file into active part select in the Main Menu *File -> Import -> Picture...* item.
+
+Result
+""""""
+
+.. figure:: images/imageImported.png
+   :align: center
+
+   Import of PNG image file.
+
 **See Also** a sample TUI Script of :ref:`tui_import_file` operation.
 
 
index 64b63156be7cad4c15df08ccbea2c19cf2b807b1..d867bf881ff171e24164a97668e0430062abc963 100644 (file)
@@ -1455,25 +1455,27 @@ void PartSet_Module::customizePresentation(const ObjectPtr& theObject,
         Handle(AIS_InteractiveObject) anAIS = thePrs->impl<Handle(AIS_InteractiveObject)>();
         if (!anAIS.IsNull())
         {
-          std::vector<int> aColor = {167, 167, 167 };
-          thePrs->setColor(aColor[0], aColor[1], aColor[2]);
-          Quantity_Color myShadingColor(NCollection_Vec3<float>(aColor[0]/255.,  aColor[1]/255., aColor[2]/255.));
-
+          /// set color to white and change material aspect,
+          /// in order to keep a natural apect of the image.
+          thePrs->setColor(255, 255, 255);
+          Quantity_Color myShadingColor(NCollection_Vec3<float>(1.,  1., 1.));
           Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS);
           if (!anAISShape.IsNull())
           {
-            auto myDrawer = new Prs3d_ShadingAspect();
-            if (!anAISShape->Attributes()->HasOwnShadingAspect())
-            {
-              anAISShape->Attributes()->SetShadingAspect (myDrawer);
-            }
+            auto myDrawer = anAISShape->Attributes();
 
-            myDrawer->SetColor(myShadingColor);
+            myDrawer->ShadingAspect()->SetColor(myShadingColor);
+            myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
+            Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
+            aMatAspect.SetTransparency(0.0);
+            myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
+            myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
 
             Handle(Image_PixMap) aPixmap;
             QPixmap px(aResult->getTextureFile().c_str());
+
             if (!px.isNull() )
-              aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
+              aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage());
 
             anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap
                 (new Graphic3d_Texture2Dmanual(aPixmap));