Drawings SDK Developer Guide > Working with Point Clouds > Working with Point Clouds with PointCloud SDK > Read .rcp Files
Read .rcs Files

Read an .rcp File

PointCloud SDK provides access to the RCP format using a special service. This topic describes how to use the service to load data from the RCP format. RCP (Reality Capture Project) is a file format that stores point cloud project data.

A point cloud project operates with a set of point cloud scans as a whole unit. After importing a point cloud project, you will be working with the whole point cloud, not with separate files. Point cloud project files have an ".rcp" file extension. The file is a ZIP-archive that contains two preview images and an .xml file with point cloud project information. The information stored in the .xml file contains a set of links to the scan files (.rcs files), a set of their properties as well as common properties of the project. This means that an .rcp file stores only the links to the point cloud laser scan files; it does not contain the scan files. To import a point cloud project to an application, its .rcs files must be available.

To read point cloud project data from .rcp files, PointCloud SDK provides the RcsFileServices.tx extension module (the same as used to read data from .rcs files). The module contains the method which reads project data from an .rcp file:

virtual OdPointCloudProjectDatabasePtr readRcpFile(const OdString& filePath) const = 0 

The method takes a path to the .rcp file as an argument and returns a pointer to OdPointCloudProjectDatabase object representing the .rcp file in runtime.

Scan RCP Data

Once the data is read to an OdPointCloudProjectDatabase object, you'll get access to the project information using the following OdPointCloudProjectDatabase class methods:

Method Brief Description
virtual OdString getProjectDatabaseFilePath() const = 0; Gets the path to an .rcp file associated with the database.
virtual OdPointCloudScanIteratorPtr getScanIterator() const = 0; Creates a new point cloud scan iterator and returns a shared pointer to it.
virtual void getAllRcsFilePaths(OdStringArray &list) const = 0; Gets the list of paths for all .rcs files associated with the .rcp file
virtual void getAllRcsRelativeFilePaths( OdStringArray &list ) const = 0; Gets the list of relative paths for all .rcs files associated with the .rcp file
virtual OdGeMatrix3d getGlobalTransformation() const = 0; Gets the global transformation matrix.
virtual OdGeMatrix3d getScanTransform(const OdString &guid) const = 0; Gets the scan transformation matrix.
virtual OdUInt32 getTotalRegionsCount() const = 0; Gets the total regions count.
virtual OdUInt32 getTotalScansCount() const = 0; Gets the total scans count.
virtual OdString getCoordinateSystemName() const = 0; Gets the coordinate system name.
virtual OdInt8 hasRGB() const = 0; Indicates whether the associated .rcs files contain colors.
virtual OdInt8 hasNormals() const = 0; Indicates whether the associated .rcs files contain normals.
virtual OdInt8 hasIntensity() const = 0; Indicates whether the associated .rcs files contain intensity.
virtual OdString getRcsFilePath(const OdString &guid) const = 0; Gets the path to an .rcs file specified by a GUID.
virtual OdString getRcsRelativeFilePath(const OdString &guid) const = 0; Gets the relative path to an .rcs file specified by a GUID.
virtual OdUInt64 getTotalAmountOfPoints() const = 0; Gets the total number of points for the point cloud project.
virtual OdGeExtents3d getExtents() const = 0; Gets the full extents of the point cloud project.
virtual void writeAllXmlDataToStream(OdStreamBuf* s) = 0; Writes all point cloud project XML data to a specified stream.

To iterate through the scans of the project you may use OdPointCloudScanIterator object which can be obtained from OdPointCloudProjectDatabase.

OdPointCloudScanIterator also provide you an ability to get properties set for a specific scan within the project. In addition, you can get a pointer to the specific OdPointCloudScanDatabase from the point cloud project database for further work with it. The following example demonstrate this approach:


OdPointCloudProjectDatabasePtr pProjectDb = pModule->readRcpFile(filePath);

OdPointCloudScanIteratorPtr pScanIt = pProjectDb->getScanIterator();
if (!pScanIt.isNull())
{
  for (; !pScanIt->done(); pScanIt->step())
  {
    odPrintConsoleString(OD_T("Title = %ls\n"), 
pScanIt->getScanTitle().c_str());
    odPrintConsoleString(OD_T("Visible = %d\n\n"), 
pScanIt->getScanIsVisible());

    OdGeMatrix3d scanTransform = pScanIt->getScanTransform();
    OdGeVector3d scanTransform_CsXAxis = scanTransform.getCsXAxis();
    OdGeVector3d scanTransform_CsYAxis = scanTransform.getCsYAxis();
    OdGeVector3d scanTransform_CsZAxis = scanTransform.getCsZAxis();
    OdGePoint3d scanTransform_CsOrigin = scanTransform.getCsOrigin();

    odPrintConsoleString(OD_T("scanTransform in project:\n"));
    odPrintConsoleString(OD_T("\t%lf  %lf  %lf  0.0\n"), scanTransform_CsXAxis.x, scanTransform_CsXAxis.y, scanTransform_CsXAxis.z);
    odPrintConsoleString(OD_T("\t%lf  %lf  %lf  0.0\n"), scanTransform_CsYAxis.x, scanTransform_CsYAxis.y, scanTransform_CsYAxis.z);
    odPrintConsoleString(OD_T("\t%lf  %lf  %lf  0.0\n"), scanTransform_CsZAxis.x, scanTransform_CsZAxis.y, scanTransform_CsZAxis.z);
    odPrintConsoleString(OD_T("\t%lf  %lf  %lf  1.0\n\n"), scanTransform_CsOrigin.x, scanTransform_CsOrigin.y, scanTransform_CsOrigin.z);

    OdPointCloudScanDatabasePtr pScanDb = pScanIt->getScanDb();
    if (!pScanDb.isNull())
    {
      dumpRcsFile(pScanDb.get());
    }
    else
    {
      odPrintConsoleString(OD_T("Scan file is not found!\n\n"));
    }    
  }
}
    

For more information, see also the RcsPointCloudReadEx sample application.

See Also

Basic Concept and List of Supported Point Cloud Formats

Read .rcs Files

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.