Пример #1
0
bool FileFormatInstance::Open( ImageDescriptionArray& images,
                               const String& filePath, const IsoString& hints )
{
   images.Clear();

   if ( (*API->FileFormat->OpenImageFileEx)( handle, filePath.c_str(), hints.c_str(), 0/*flags*/ ) == api_false )
      return false;

   for ( uint32 i = 0, n = (*API->FileFormat->GetImageCount)( handle ); i < n; ++i )
   {
      IsoString id;
      size_type len = 0;
      (*API->FileFormat->GetImageId)( handle, 0, &len, i );
      if ( len > 0 )
      {
         id.SetLength( len );
         if ( (*API->FileFormat->GetImageId)( handle, id.Begin(), &len, i ) == api_false )
            throw APIFunctionError( "GetImageId" );
         id.ResizeToNullTerminated();
      }

      api_image_info info;
      api_image_options options;
      if ( (*API->FileFormat->GetImageDescription)( handle, &info, &options, i ) == api_false )
         throw APIFunctionError( "GetImageDescription" );

      ImageDescription d;
      d.id = id;
      APIImageInfoToPCL( d.info, info );
      APIImageOptionsToPCL( d.options, options );
      images.Add( d );
   }

   return true;
}
Пример #2
0
ToolButton::ToolButton( const String& text, const pcl::Bitmap& icon, bool checkable, Control& parent ) :
Button( (*API->Button->CreateToolButton)(
       ModuleHandle(), this, text.c_str(), icon.handle, checkable, parent.handle, 0 /*flags*/ ) )
{
   if ( handle == 0 )
      throw APIFunctionError( "CreateToolButton" );
}
Пример #3
0
ViewPropertyAttributes View::PropertyAttributes( const IsoString& property ) const
{
   uint32 flags = 0;
   if ( (*API->View->GetViewPropertyAttributes)( ModuleHandle(), handle, property.c_str(), &flags, 0/*type*/ ) == api_false )
      throw APIFunctionError( "GetViewPropertyAttributes" );
   return ViewPropertyAttributes( ViewPropertyAttribute::mask_type( flags ) );
}
Пример #4
0
Variant::data_type View::PropertyType( const IsoString& property ) const
{
   uint64 type = 0;
   if ( (*API->View->GetViewPropertyAttributes)( ModuleHandle(), handle, property.c_str(), 0/*flags*/, &type ) == api_false )
      throw APIFunctionError( "GetViewPropertyAttributes" );
   return VariantTypeFromAPIPropertyType( type );
}
Пример #5
0
void View::SetPropertyValue( const IsoString& property, const Variant& value, bool notify, ViewPropertyAttributes attributes )
{
   api_property_value apiValue;
   APIPropertyValueFromVariant( apiValue, value );
   if ( (*API->View->SetViewPropertyValue)( ModuleHandle(), handle, property.c_str(), &apiValue, attributes, notify ) == api_false )
      throw APIFunctionError( "SetViewPropertyValue" );
}
Пример #6
0
Variant View::ComputeProperty( const IsoString& property, bool notify )
{
   api_property_value value;
   if ( (*API->View->ComputeViewProperty)( ModuleHandle(), handle, property.c_str(), notify, &value ) == api_false )
      throw APIFunctionError( "ComputeViewProperty" );
   return VariantFromAPIPropertyValue( value );
}
Пример #7
0
Variant View::PropertyValue( const IsoString& property ) const
{
   api_property_value value;
   if ( (*API->View->GetViewPropertyValue)( ModuleHandle(), handle, property.c_str(), &value ) == api_false )
      throw APIFunctionError( "GetViewPropertyValue" );
   return VariantFromAPIPropertyValue( value );
}
Пример #8
0
void View::SetScreenTransferFunctions( const stf_list& stf, bool notify )
{
   double m[ 4 ], c0[ 4 ], c1[ 4 ], r0[ 4 ], r1[ 4 ];

   for ( size_type i = 0; i < 4; ++i )
   {
      if ( i < stf.Length() )
      {
         const HistogramTransformation& H = stf[i];
         m[i]  = H.MidtonesBalance();
         c0[i] = H.ShadowsClipping();
         c1[i] = H.HighlightsClipping();
         r0[i] = H.LowRange();
         r1[i] = H.HighRange();
      }
      else
      {
         m[i]  = 0.5;
         c0[i] = r0[i] = 0;
         c1[i] = r1[i] = 1;
      }
   }

   if ( (*API->View->SetViewScreenTransferFunctions)( handle, m, c0, c1, r0, r1, notify ) == api_false )
      throw APIFunctionError( "SetViewScreenTransferFunctions" );
}
Пример #9
0
ImageVariant View::Image() const
{
   image_handle hImg = (*API->View->GetViewImage)( handle );
   if ( hImg != 0 )
   {
      uint32 bitsPerSample;
      api_bool isFloat;

      if ( !(*API->SharedImage->GetImageFormat)( hImg, &bitsPerSample, &isFloat ) )
         throw APIFunctionError( "GetImageFormat" );

      /*
       * Use a private ImageVariant constructor that forces image ownership by
       * ImageVariant. This constructor is selected with the second dummy int
       * argument (set to zero below).
       */
      if ( isFloat )
         switch ( bitsPerSample )
         {
         case 32 : return ImageVariant( new pcl::Image( hImg ), 0 );
         case 64 : return ImageVariant( new pcl::DImage( hImg ), 0 );
         }
      else
         switch ( bitsPerSample )
         {
         case  8 : return ImageVariant( new pcl::UInt8Image( hImg ), 0 );
         case 16 : return ImageVariant( new pcl::UInt16Image( hImg ), 0 );
         case 32 : return ImageVariant( new pcl::UInt32Image( hImg ), 0 );
         }
   }

   return ImageVariant();
}
Пример #10
0
void PCL_FUNC InPlaceGaussJordan( FMatrix& A, FMatrix& B )
{
   A.SetUnique();
   B.SetUnique();
   if ( (*API->Numerical->GaussJordanInPlaceF)( A.DataPtr(), B.DataPtr(), A.Rows(), B.Columns() ) == api_false )
      throw APIFunctionError( "GaussJordanInPlaceF" );
}
Пример #11
0
double CubicSplineInterpolationBase::Interpolate( const double* fx, const double* fy, const double* dy2, int n, double x, int32& k )
{
   double y;
   if ( (*API->Numerical->CubicSplineInterpolateD)( &y, fx, fy, dy2, n, x, &k ) == api_false )
      throw APIFunctionError( "CubicSplineInterpolateD" );
   return y;
}
Пример #12
0
double CubicSplineInterpolationBase::Interpolate( const uint32* fy, const double* dy2, int n, double x )
{
   double y;
   if ( (*API->Numerical->NaturalGridCubicSplineInterpolateUI32)( &y, fy, dy2, n, x ) == api_false )
      throw APIFunctionError( "NaturalGridCubicSplineInterpolateUI32" );
   return y;
}
Пример #13
0
float CubicSplineInterpolationBase::Interpolate( const uint16* fy, const float* dy2, int n, double x )
{
   float y;
   if ( (*API->Numerical->NaturalGridCubicSplineInterpolateUI16)( &y, fy, dy2, n, x ) == api_false )
      throw APIFunctionError( "NaturalGridCubicSplineInterpolateUI16" );
   return y;
}
Пример #14
0
float Pen::Width() const
{
   float width;
   if ( (*API->Pen->GetPenWidth)( handle, &width ) == api_false )
      throw APIFunctionError( "GetPenWidth" );
   return width;
}
Пример #15
0
void SurfaceSplineBase::Generate( double* fx, double* fy, const double* fz, int n,
                                  int m, float r, const float* w, double* cv,
                                  double& rm, double& xm, double& ym )
{
   if ( (*API->Numerical->SurfaceSplineGenerateD)( cv, &rm, &xm, &ym, fx, fy, fz, n, m, r, w ) == api_false )
      throw APIFunctionError( "SurfaceSplineGenerateD" );
}
Пример #16
0
DRect SVG::ViewBox() const
{
   DRect r;
   if ( (*API->SVG->GetSVGViewBox)( handle, &r.x0, &r.y0, &r.x1, &r.y1 ) == api_false )
      throw APIFunctionError( "GetSVGViewBox" );
   return r;
}
Пример #17
0
BitmapBox::BitmapBox( const Bitmap& bm, Control& parent ) :
Frame( (*API->BitmapBox->CreateBitmapBox)(
            ModuleHandle(), this, bm.handle, parent.handle, 0 /*flags*/ ) )
{
   if ( handle == 0 )
      throw APIFunctionError( "CreateBitmapBox" );
}
Пример #18
0
Console::Console() : m_handle( 0 ), m_thread( 0 )
{
   if ( (m_handle = (*API->Global->GetConsole)()) == 0 )
      throw APIFunctionError( "GetConsole" );

   m_thread = (*API->Thread->GetCurrentThread)();
}
Пример #19
0
ProcessParameter::data_type ProcessParameter::Type() const
{
   if ( IsNull() )
      return ProcessParameterType::Invalid;

   uint32 apiType = (*API->Process->GetParameterType)( m_data->handle );
   if ( apiType == 0 )
      throw APIFunctionError( "GetParameterType" );

   switch ( apiType & PTYPE_TYPE_MASK )
   {
   case PTYPE_UINT8:  return ProcessParameterType::UInt8;
   case PTYPE_INT8:   return ProcessParameterType::Int8;
   case PTYPE_UINT16: return ProcessParameterType::UInt16;
   case PTYPE_INT16:  return ProcessParameterType::Int16;
   case PTYPE_UINT32: return ProcessParameterType::UInt32;
   case PTYPE_INT32:  return ProcessParameterType::Int32;
   case PTYPE_UINT64: return ProcessParameterType::UInt64;
   case PTYPE_INT64:  return ProcessParameterType::Int64;
   case PTYPE_FLOAT:  return ProcessParameterType::Float;
   case PTYPE_DOUBLE: return ProcessParameterType::Double;
   case PTYPE_BOOL:   return ProcessParameterType::Boolean;
   case PTYPE_ENUM:   return ProcessParameterType::Enumeration;
   case PTYPE_STRING: return ProcessParameterType::String;
   case PTYPE_TABLE:  return ProcessParameterType::Table;
   case PTYPE_BLOCK:  return ProcessParameterType::Block;
   default:           throw Error( "ProcessParameter::Type(): Internal error: Unknown parameter type" );
   }
}
Пример #20
0
void ExternalProcess::Write( const void* data, size_type count )
{
   if ( data != nullptr )
      if ( count > 0 )
         if ( (*API->ExternalProcess->WriteToExternalProcess)( handle, data, count ) == api_false )
            throw APIFunctionError( "WriteToExternalProcess" );
}
Пример #21
0
Array<FileFormat> FileFormat::AllFormats()
{
   Array<FileFormat> formats;
   if ( (*API->FileFormat->EnumerateFileFormats)( FileFormatPrivate::EnumerationCallback, &formats ) == api_false )
      throw APIFunctionError( "EnumerateFileFormats" );
   return formats;
}
Пример #22
0
void ExternalProcess::Write( const char* text )
{
   if ( text != nullptr )
      if ( *text != '\0' )
         if ( (*API->ExternalProcess->WriteToExternalProcess)( handle, text, strlen( text ) ) == api_false )
            throw APIFunctionError( "WriteToExternalProcess" );
}
Пример #23
0
void ExternalProcess::OnError( process_error_event_handler handler, Control& receiver )
{
   INIT_EVENT_HANDLERS();
   if ( (*API->ExternalProcess->SetExternalProcessErrorEventRoutine)( handle, &receiver,
                     (handler != nullptr) ? ExternalProcessEventDispatcher::Error : 0 ) == api_false )
      throw APIFunctionError( "SetExternalProcessErrorEventRoutine" );
   m_handlers->onError = handler;
}
Пример #24
0
void ExternalProcess::OnStandardErrorDataAvailable( process_event_handler handler, Control& receiver )
{
   INIT_EVENT_HANDLERS();
   if ( (*API->ExternalProcess->SetExternalProcessStandardErrorDataAvailableEventRoutine)( handle, &receiver,
                     (handler != nullptr) ? ExternalProcessEventDispatcher::StandardErrorDataAvailable : 0 ) == api_false )
      throw APIFunctionError( "SetExternalProcessStandardErrorDataAvailableEventRoutine" );
   m_handlers->onStandardErrorDataAvailable = handler;
}
Пример #25
0
void ExternalProcess::SetEnvironment( const StringList& environment )
{
   Array<const char16_type*> vars;
   for ( StringList::const_iterator i = environment.Begin(); i != environment.End(); ++i )
      vars.Add( i->c_str() );
   if ( (*API->ExternalProcess->SetExternalProcessEnvironment)( handle, vars.Begin(), vars.Length() ) == api_false )
      throw APIFunctionError( "SetExternalProcessEnvironment" );
}
Пример #26
0
void ExternalProcess::Start( const String& program, const StringList& arguments )
{
   Array<const char16_type*> argv;
   for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
      argv.Add( i->c_str() );
   if ( (*API->ExternalProcess->StartExternalProcess)( handle, program.c_str(), argv.Begin(), argv.Length() ) == api_false )
      throw APIFunctionError( "StartExternalProcess" );
}
Пример #27
0
Dialog::Dialog( Control& parent ) :
Control( (*API->Dialog->CreateDialog)( ModuleHandle(), this, parent.handle, 0 /*flags*/ ) ),
onExecute( 0 ),
onReturn( 0 )
{
   if ( handle == 0 )
      throw APIFunctionError( "CreateDialog" );
}
Пример #28
0
Timer::Timer() :
UIObject( (*API->Timer->CreateTimer)( ModuleHandle(), this, 0/*flags*/ ) ),
onTimer( 0 ),
count( 0 )
{
   if ( handle == 0 )
      throw APIFunctionError( "CreateTimer" );
}
Пример #29
0
Slider::Slider( Control& parent, bool vertical ) :
Control( (*API->Slider->CreateSlider)( ModuleHandle(), this, vertical, parent.handle, 0 /*flags*/ ) ),
onValueUpdated( 0 ),
onRangeUpdated( 0 )
{
   if ( handle == 0 )
      throw APIFunctionError( "CreateSlider" );
}
Пример #30
0
double SurfaceSplineBase::Interpolate( const double* fx, const double* fy, int n,
                                       const double* cv, int m, double x, double y )
{
   double z;
   if ( (*API->Numerical->SurfaceSplineInterpolateD)( &z, fx, fy, cv, n, m, x, y ) == api_false )
      throw APIFunctionError( "SurfaceSplineInterpolateD" );
   return z;
}