Skip to content

File ManagedPointCloud.h

File List > SpinnakerNET > ManagedPointCloud.h

Go to the documentation of this file

//=============================================================================
// Copyright (c) 2026 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR).
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================

#ifndef FLIR_SPINNAKER_MANAGED_POINTCLOUD_H
#define FLIR_SPINNAKER_MANAGED_POINTCLOUD_H

#include "ManagedDefs.h"
#include "PointCloud.h"

using namespace ::System;
using namespace ::System::Runtime::InteropServices;

namespace SpinnakerNET
{
    public ref class ManagedPointCloud : IDisposable
    {
        public:
            ManagedPointCloud();
            ManagedPointCloud(const Spinnaker::PointCloud& pPointCloud);
            ManagedPointCloud(const ManagedPointCloud% other)
                : m_pPointCloud(new Spinnaker::PointCloud(*other.m_pPointCloud))
            {
            }

            ~ManagedPointCloud();
            !ManagedPointCloud();  // Finalizer

            void AddPoint(Stereo3DPoint point);

            // Custom assignment method
            void DeepCopy(ManagedPointCloud^ otherPointCloud);

            Stereo3DPoint GetPoint(unsigned int index);
            unsigned int GetNumPoints();
            void SavePointCloudAsPly(String^ fileName);
            void LoadPointCloudFromPly(String^ fileName);
            void PrintPoints(unsigned int numPointsToPrint);
            void Clear();

            ManagedPointCloud^ operator=(const ManagedPointCloud% other)
            {
                if (this == % other)
                {
                    return this; // Self-assignment protection
                }

                // Clean up current resources
                this->!ManagedPointCloud();

                // Perform deep copy
                m_pPointCloud = new Spinnaker::PointCloud(*other.m_pPointCloud);

                return this;
            }
        internal:
            Spinnaker::PointCloud* GetNativePointCloudPointer();
        private:
            Spinnaker::PointCloud* m_pPointCloud; // nativePointCloud;
    };
}

#endif