DataType OrNode::typeCheck(SemanticDebugger *semanticDebugger) { DataType leftType = this->leftOperand_->typeCheck(semanticDebugger); if(leftType == DATA_TYPE_BOOLEAN) { DataType rightType = this->rightOperand_->typeCheck(semanticDebugger); if(rightType == DATA_TYPE_BOOLEAN) { this->checkConstant(); setDataType(DATA_TYPE_BOOLEAN); return DATA_TYPE_BOOLEAN; } else if(rightType != DATA_TYPE_ERROR) { semanticDebugger->debugExpectedBooleanExpressionError("OR expression right's operand", this->rightOperand_->getFirstLine()); } } else if(leftType != DATA_TYPE_ERROR) { semanticDebugger->debugExpectedBooleanExpressionError("OR expression left's operand", this->leftOperand_->getFirstLine()); } setDataType(DATA_TYPE_ERROR); return DATA_TYPE_ERROR; }
ImageSourceChannel( const ChannelT<T> &channel ) : ImageSource() { mWidth = channel.getWidth(); mHeight = channel.getHeight(); setColorModel( ImageIo::CM_GRAY ); setChannelOrder( ImageIo::Y ); if( channel.getIncrement() != 1 ) setCustomPixelInc( channel.getIncrement() ); if( boost::is_same<T,uint8_t>::value ) { setDataType( ImageIo::UINT8 ); mChannel8u = *reinterpret_cast<const Channel8u*>( &channel ); // register reference to 'channel' } else if( boost::is_same<T,uint16_t>::value ) { setDataType( ImageIo::UINT16 ); mChannel16u = *reinterpret_cast<const Channel16u*>( &channel ); // register reference to 'channel' } else if( boost::is_same<T,float>::value ) { setDataType( ImageIo::FLOAT32 ); mChannel32f = *reinterpret_cast<const Channel32f*>( &channel ); // register reference to 'channel' } else throw; // this channel seems to be a type we've never met mRowBytes = channel.getRowBytes(); mData = reinterpret_cast<const uint8_t*>( channel.getData() ); }
DataType ArithmeticNode::typeCheck(SemanticDebugger *semanticDebugger) { DataType leftType = this->leftOperand_->typeCheck(semanticDebugger); if(leftType == DATA_TYPE_INTEGER) { DataType rightType = this->rightOperand_->typeCheck(semanticDebugger); if(rightType == DATA_TYPE_INTEGER) { this->checkConstant(); setDataType(DATA_TYPE_INTEGER); return DATA_TYPE_INTEGER; } else if(rightType != DATA_TYPE_ERROR) { semanticDebugger->debugExpectedIntegerExpressionError("arithmetic expression right's operand", this->rightOperand_->getFirstLine()); } } else if(leftType != DATA_TYPE_ERROR) { semanticDebugger->debugExpectedIntegerExpressionError("arithmetic expression left's operand", this->leftOperand_->getFirstLine()); } setDataType(DATA_TYPE_ERROR); return DATA_TYPE_ERROR; }
ImageTargetSurface<T>::ImageTargetSurface( SurfaceT<T> *aSurface ) : ImageTarget(), mSurface( aSurface ) { if( boost::is_same<T,float>::value ) setDataType( ImageIo::FLOAT32 ); else if( boost::is_same<T,uint16_t>::value ) setDataType( ImageIo::UINT16 ); else if( boost::is_same<T,uint8_t>::value ) setDataType( ImageIo::UINT8 ); else throw; // what is this? setColorModel( ImageIo::CM_RGB ); // set the target's ChannelT order based on the SurfaceT's switch ( mSurface->getChannelOrder().getCode() ) { case SurfaceChannelOrder::RGBA: setChannelOrder( ImageIo::RGBA ); break; case SurfaceChannelOrder::BGRA: setChannelOrder( ImageIo::BGRA ); break; case SurfaceChannelOrder::ARGB: setChannelOrder( ImageIo::ARGB ); break; case SurfaceChannelOrder::ABGR: setChannelOrder( ImageIo::ABGR ); break; case SurfaceChannelOrder::RGBX: setChannelOrder( ImageIo::RGBX ); break; case SurfaceChannelOrder::BGRX: setChannelOrder( ImageIo::BGRX ); break; case SurfaceChannelOrder::XRGB: setChannelOrder( ImageIo::XRGB ); break; case SurfaceChannelOrder::XBGR: setChannelOrder( ImageIo::XBGR ); break; case SurfaceChannelOrder::RGB: setChannelOrder( ImageIo::RGB ); break; case SurfaceChannelOrder::BGR: setChannelOrder( ImageIo::BGR ); break; default: setChannelOrder( ImageIo::CUSTOM ); // in case we don't find a match break; } }
ImageTargetChannel( ChannelT<T> *channel ) : mChannel( channel ) { if( boost::is_same<T,float>::value ) setDataType( ImageIo::FLOAT32 ); else if( boost::is_same<T,uint16_t>::value ) setDataType( ImageIo::UINT16 ); else if( boost::is_same<T,uint8_t>::value ) setDataType( ImageIo::UINT8 ); else throw; // what is this? setColorModel( ImageIo::CM_GRAY ); setChannelOrder( ImageIo::Y ); }
void core::DotMatrix::init(int dotSize, int rows, int cols, DataFormat dt) { this->size = dotSize; //QActions continuousDrawingAction = new QAction(ICON_FREEHAND, "Dibujo continuo", this); clearAction = new QAction(ICON_CLEAR, "Limpiar", this); fillAction = new QAction(ICON_FILL, "Llenar", this); eraserAction = new QAction(ICON_ERASER, "Borrador", this); continuousDrawingAction->setCheckable(true); eraserAction->setCheckable(true); contextMenu.insertAction(getLockAction(), continuousDrawingAction); contextMenu.insertAction(continuousDrawingAction, fillAction); contextMenu.insertAction(fillAction, clearAction); contextMenu.insertAction(clearAction, eraserAction); setEnableContinuousDrawing(true); setEnableEraserPen(false); setRows(rows); setCols(cols); setEnableEdit(true); setBorder(QPen(Qt::black, 1)); setContainerRect(getContainer()); setDataType(dt); connect(continuousDrawingAction, SIGNAL(triggered(bool)), SLOT(setEnableContinuousDrawing(bool))); connect(clearAction, SIGNAL(triggered()), SLOT(clear())); connect(fillAction, SIGNAL(triggered()), SLOT(fill())); connect(eraserAction, SIGNAL(triggered(bool)), SLOT(setEnableEraserPen(bool))); }
void RasterInfo::loadInfo() { QFile *file = new QFile( fileName + ".img.info" ); file->open( QIODevice::ReadOnly ); QStringList inFile( QString(file->readAll()).split('\n') ); file->close(); delete file; ////////Rows and Columns row = inFile[0].split(' ')[0].toInt(); col = inFile[0].split(' ')[1].toInt(); projcode = inFile[1].toInt(); //Projection Number/Name zonecode = inFile[2].toInt(); //Zone Code unitcode = 2; //Unit Type NOTE: mapimg currently only supports meters datumcode = 19; //Spheroid Name NOTE: mapimg currently only supports Sphere pixsize = inFile[5].toDouble(); //Pixel Size ////////UL Latitude and Longitude ulx = inFile[6].split(' ')[0].toDouble(); uly = inFile[6].split(' ')[1].toDouble(); ////////15 GCTP Params QStringList gctpValues = inFile[7].split(" "); for( int i = 0; i < 15; ++i ) gctpParams[i] = gctpValues[i].toDouble(); setDataType( inFile[8] ); //Data Type }
ImageTargetGWorld::ImageTargetGWorld( ImageSourceRef imageSource ) : ImageTarget(), mGWorld( 0 ), mPixMap( 0 ) { setSize( (size_t)imageSource->getWidth(), (size_t)imageSource->getHeight() ); OSType formatType; // for now all we support is 8 bit RGBA setDataType( ImageIo::UINT8 ); formatType = k32ARGBPixelFormat; setChannelOrder( ImageIo::ARGB ); setColorModel( ImageIo::CM_RGB ); ::Rect boundsRect; boundsRect.left = boundsRect.top = 0; boundsRect.right = (short)imageSource->getWidth(); boundsRect.bottom = (short)imageSource->getHeight(); if( ::QTNewGWorld( &mGWorld, formatType, &boundsRect, NULL, NULL, 0 ) != noErr ) throw ImageIoException(); mPixMap = ::GetGWorldPixMap( mGWorld ); if( ! ::LockPixels( mPixMap ) ) { ::DisposeGWorld( mGWorld ); throw ImageIoException(); } #if defined( CINDER_MSW ) mData = reinterpret_cast<uint8_t*>( (**mPixMap).baseAddr ); mRowBytes = ( (**mPixMap).rowBytes ) & 0x3FFF; #else mData = reinterpret_cast<uint8_t*>( ::GetPixBaseAddr( mPixMap ) ); mRowBytes = ::GetPixRowBytes( mPixMap ); #endif }
void RKVariable::setVarType (RObject::RDataType new_type, bool sync) { RK_TRACE (OBJECTS); if (getDataType () == new_type) { return; } // if the variable is currently opened for editing, all values need to be rechecked / resynced if (myData ()) { bool internal_sync = myData ()->immediate_sync; setSyncing (false); // quick and dirty approach! TODO: make more efficient QStringList list; for (int i=0; i < getLength (); ++i) { list.append (getText (i)); } setDataType (new_type); if (new_type == RObject::DataCharacter) { if (myData ()->cell_strings == 0) { delete [] (myData ()->cell_doubles); myData ()->cell_doubles = 0; myData ()->cell_strings = new QString[getLength ()]; } } else { if (myData ()->cell_doubles == 0) { delete [] (myData ()->cell_strings); myData ()->cell_strings = 0; myData ()->cell_doubles = new double[getLength ()]; } } int i = 0; for (QStringList::const_iterator it = list.constBegin (); it != list.constEnd (); ++it) { setText (i, *it); i++; } if (sync) { syncDataToR (); } setSyncing (internal_sync); } else { setDataType (new_type); } setMetaProperty ("type", QString ().setNum ((int) new_type), sync); }
ImageTargetCvPixelBuffer::ImageTargetCvPixelBuffer( ImageSourceRef imageSource, bool convertToYpCbCr ) : ImageTarget(), mPixelBufferRef( 0 ), mConvertToYpCbCr( convertToYpCbCr ) { setSize( (size_t)imageSource->getWidth(), (size_t)imageSource->getHeight() ); //http://developer.apple.com/mac/library/qa/qa2006/qa1501.html // if we're converting to YCbCr, we'll load all of the data as RGB in terms of ci::ImageIo // but we run color space conversion over it later in the finalize method OSType formatType; if( ! mConvertToYpCbCr ) { switch( imageSource->getDataType() ) { // for now all we support is 8 bit RGB(A) case ImageIo::UINT16: case ImageIo::FLOAT32: case ImageIo::UINT8: setDataType( ImageIo::UINT8 ); if( imageSource->hasAlpha () ) { formatType = k32ARGBPixelFormat; setChannelOrder( ImageIo::ARGB ); } else { formatType = k24RGBPixelFormat; setChannelOrder( ImageIo::RGB ); } setColorModel( ImageIo::CM_RGB ); break; default: throw ImageIoException(); } } else { formatType = 'v408';/*k4444YpCbCrA8PixelFormat;*/ setDataType( ImageIo::UINT8 ); setChannelOrder( ImageIo::RGBA ); setColorModel( ImageIo::CM_RGB ); } if( ::CVPixelBufferCreate( kCFAllocatorDefault, imageSource->getWidth(), imageSource->getHeight(), formatType, NULL, &mPixelBufferRef ) != kCVReturnSuccess ) throw ImageIoException(); if( ::CVPixelBufferLockBaseAddress( mPixelBufferRef, 0 ) != kCVReturnSuccess ) throw ImageIoException(); mData = reinterpret_cast<uint8_t*>( ::CVPixelBufferGetBaseAddress( mPixelBufferRef ) ); mRowBytes = ::CVPixelBufferGetBytesPerRow( mPixelBufferRef ); }
ImageSourceOpenNIUserMask( uint8_t *buffer, int w, int h, shared_ptr<UserTracker::Obj> ownerObj ) : ImageSource(), mData( buffer ), mOwnerObj( ownerObj ) { setSize( w, h ); setColorModel( ImageIo::CM_GRAY ); setChannelOrder( ImageIo::Y ); setDataType( ImageIo::UINT8 ); }
// part of this being separated allows for us to play nicely with the setjmp of libpng bool ImageSourcePng::loadHeader() { bool success = true; if( setjmp( png_jmpbuf(mPngPtr) ) ) { success = false; } else { png_read_info( mPngPtr, mInfoPtr ); png_uint_32 width, height; int bitDepth, colorType, interlaceType, compressionType, filterMethod; if( ! png_get_IHDR( mPngPtr, mInfoPtr, &width, &height, &bitDepth, &colorType, &interlaceType, &compressionType, &filterMethod ) ) { png_destroy_read_struct( &mPngPtr, &mInfoPtr, (png_infopp)NULL ); mPngPtr = 0; return false; } setSize( width, height ); setDataType( ( bitDepth == 16 ) ? ImageIo::UINT16 : ImageIo::UINT8 ); #ifdef CINDER_LITTLE_ENDIAN png_set_swap( mPngPtr ); #endif switch( colorType ) { case PNG_COLOR_TYPE_GRAY: setColorModel( ImageIo::CM_GRAY ); setChannelOrder( ImageIo::Y ); break; case PNG_COLOR_TYPE_GRAY_ALPHA: setColorModel( ImageIo::CM_GRAY ); setChannelOrder( ImageIo::YA ); break; case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_PALETTE: setColorModel( ImageIo::CM_RGB ); setChannelOrder( ImageIo::RGB ); break; case PNG_COLOR_TYPE_RGB_ALPHA: setColorModel( ImageIo::CM_RGB ); setChannelOrder( ImageIo::RGBA ); break; default: throw ImageSourcePngException( "Unexpected png color type." ); } png_set_expand_gray_1_2_4_to_8( mPngPtr ); png_set_palette_to_rgb( mPngPtr ); png_set_tRNS_to_alpha( mPngPtr ); png_read_update_info( mPngPtr, mInfoPtr ); } return success; }
void GDataDup::saveData(void){ setDataName(m_pleName->text()); setDataType(m_pcbDataType->currentText()); setDupValue(m_psbNumOfDup->text().toInt()); for(int i = 0; i < m_pcbValues->count(); ++i){ m_pstrlstValues->push_back(m_pcbValues->itemText(i)); } }
MapimgValidator::MapimgValidator( QString mapimgDataType, bool allowUndefined, QObject* parent, const char* name ) : QValidator( parent, name ) { m_bottom = 0.0; m_top = 0.0; m_decimals = 0; m_allowUndefined = allowUndefined; setDataType( mapimgDataType ); }
PropParam::PropParam(char* paramName, char* dataType, ArrayList* valEnums, char* displayName) { this->paramName = NULL; this->dataType = NULL; this->displayName = NULL; this->valEnums = NULL; setParamName (paramName ); setDataType (dataType ); setValEnums (valEnums ); setDisplayName(displayName); }
void ImageSourceFileRadiance::loadStream( IStreamRef stream ) { setDataType( ImageIo::FLOAT32 ); setColorModel( ImageIo::CM_RGB ); setChannelOrder( ImageIo::RGB ); char str[200]; stream->readData( str, 10 ); if( memcmp( str, "#?RADIANCE", 10 ) ) throw ImageSourceFileRadianceException( "Invalid header" ); stream->seekRelative( 1 ); char cmd[200]; int i = 0; char c = 0, oldc; while( true ) { oldc = c; stream->read( &c ); if( c == 0xa && oldc == 0xa ) break; cmd[i++] = c; } char resolution[200]; i = 0; while( true ) { stream->read( &c ); resolution[i++] = c; if( c == 0xa ) break; } int width, height; #if defined( CINDER_WINRT ) if( ! sscanf_s( resolution, "-Y %d +X %d", &height, &width ) ) #else if( ! sscanf( resolution, "-Y %d +X %d", &height, &width ) ) #endif throw ImageSourceFileRadianceException( "Unable to parse size" ); setSize( width, height ); mRgbData = std::unique_ptr<float[]>( new float[width * height * 3] ); std::unique_ptr<RgbePixel[]> scanline( new RgbePixel[width] ); // convert image float *cols = mRgbData.get(); for( int y = height - 1; y >= 0; y-- ) { if( ! decrunchScanline( scanline.get(), width, stream.get() ) ) break; workOnRgbeScanline( scanline.get(), width, cols ); cols += width * 3; } }
void GData::saveData(void){ setDataName(m_pleName->text()); setDataType(m_pcbDataType->currentText()); if(m_pcbValues->count() == 0){ m_pcbValues->insertItem(0, "?"); } for(int i = 0; i < m_pcbValues->count(); ++i){ m_pstrlstValues->push_back(m_pcbValues->itemText(i)); } }
ImageTargetFileStbImage::ImageTargetFileStbImage( DataTargetRef dataTarget, ImageSourceRef imageSource, ImageTarget::Options options, const std::string &extensionData ) { if( ! dataTarget->providesFilePath() ) { throw ImageIoExceptionFailedWrite( "ImageTargetFileStbImage only supports writing to files." ); } mFilePath = dataTarget->getFilePath(); setSize( imageSource->getWidth(), imageSource->getHeight() ); ImageIo::ColorModel cm = options.isColorModelDefault() ? imageSource->getColorModel() : options.getColorModel(); switch( cm ) { case ImageIo::ColorModel::CM_RGB: mNumComponents = ( imageSource->hasAlpha() ) ? 4 : 3; setColorModel( ImageIo::ColorModel::CM_RGB ); setChannelOrder( ( mNumComponents == 4 ) ? ImageIo::ChannelOrder::RGBA : ImageIo::ChannelOrder::RGB ); break; case ImageIo::ColorModel::CM_GRAY: mNumComponents = ( imageSource->hasAlpha() ) ? 2 : 1; setColorModel( ImageIo::ColorModel::CM_GRAY ); setChannelOrder( ( mNumComponents == 2 ) ? ImageIo::ChannelOrder::YA : ImageIo::ChannelOrder::Y ); break; default: throw ImageIoExceptionIllegalColorModel(); } mExtension = extensionData; if( mExtension == "hdr" ) { // Radiance files are always float* setDataType( ImageIo::DataType::FLOAT32 ); mRowBytes = mNumComponents * imageSource->getWidth() * sizeof(float); } else { setDataType( ImageIo::DataType::UINT8 ); mRowBytes = mNumComponents * imageSource->getWidth() * sizeof(float); } mData = std::unique_ptr<uint8_t[]>( new uint8_t[mWidth * mRowBytes] ); }
ImageSourceSurface( const SurfaceT<T> &surface ) : ImageSource() { mWidth = surface.getWidth(); mHeight = surface.getHeight(); setColorModel( ImageIo::CM_RGB ); setChannelOrder( ImageIo::ChannelOrder( surface.getChannelOrder().getImageIoChannelOrder() ) ); if( boost::is_same<T,uint8_t>::value ) { setDataType( ImageIo::UINT8 ); mSurface8u = *reinterpret_cast<const Surface8u*>( &surface ); // register reference to 'surface' } else if( boost::is_same<T,uint16_t>::value ) { setDataType( ImageIo::UINT16 ); mSurface16u = *reinterpret_cast<const Surface16u*>( &surface ); // register reference to 'surface' } else if( boost::is_same<T,float>::value ) { setDataType( ImageIo::FLOAT32 ); mSurface32f = *reinterpret_cast<const Surface32f*>( &surface ); // register reference to 'surface' } else throw; // this surface seems to be a type we've never met mRowBytes = surface.getRowBytes(); mData = reinterpret_cast<const uint8_t*>( surface.getData() ); }
void IPath::setParameter( const VGint p, const VGint v ) { switch (p) { case VG_PATH_FORMAT: setFormat( v ); break; case VG_PATH_DATATYPE: setDataType( static_cast<VGPathDatatype>( v ) ); break; case VG_PATH_NUM_SEGMENTS: setNumSegments( v ); break; case VG_PATH_NUM_COORDS: setNumCoords( v ); break; default: break; } }
QPropertyLineEditor::QPropertyLineEditor(QWidget *parent,int id, QString name, double min, double max, double step) : IPropertyEditor(parent), ui(new Ui::QPropertyLineEditor) { ui->setupUi(this); this->id = id; //default type. setDataType(QVariant::Int); //qDebug()<<m_label->text(); ui->name_PropertyName->setText(name); ui->name_propertyadjust->setMinimum(min); ui->name_propertyadjust->setMaximum(max); ui->name_propertyadjust->setSingleStep(step); ui->name_propertyvalue->setMinimum(min); ui->name_propertyvalue->setMaximum(max); ui->name_propertyvalue->setSingleStep(step); }
/*! * Update field information using VTKFieldMetaData class */ void VTKField::importMetaData( const VTKFieldMetaData &data){ if( data.getSize() != -1 ){ setDataType( VTKTypes::whichType(data.getType()) ); if( getFieldType() == VTKFieldType::SCALAR ){ setElements( data.getSize() ) ; } else if (getFieldType() == VTKFieldType::VECTOR) { setElements( data.getSize() /3 ) ; } else if (getFieldType() == VTKFieldType::CONSTANT) { setElements( data.getSize() / components ); } else if (getFieldType() == VTKFieldType::VARIABLE) { setElements( data.getSize() ); } }; return ; };
ImageTargetFileTinyExr::ImageTargetFileTinyExr( DataTargetRef dataTarget, ImageSourceRef imageSource, ImageTarget::Options options, const std::string & /*extensionData*/ ) { if( ! dataTarget->providesFilePath() ) { throw ImageIoExceptionFailedWrite( "ImageTargetFileTinyExr only supports writing to files." ); } mFilePath = dataTarget->getFilePath(); setSize( imageSource->getWidth(), imageSource->getHeight() ); ImageIo::ColorModel cm = options.isColorModelDefault() ? imageSource->getColorModel() : options.getColorModel(); switch( cm ) { case ImageIo::ColorModel::CM_RGB: mNumComponents = ( imageSource->hasAlpha() ) ? 4 : 3; setColorModel( ImageIo::ColorModel::CM_RGB ); setChannelOrder( ( mNumComponents == 3 ) ? ImageIo::ChannelOrder::BGR : ImageIo::ChannelOrder::ABGR ); if( mNumComponents == 3 ) mChannelNames = { "G", "B", "R" }; else mChannelNames = { "A", "G", "B", "R" }; break; case ImageIo::ColorModel::CM_GRAY: mNumComponents = ( imageSource->hasAlpha() ) ? 2 : 1; setColorModel( ImageIo::ColorModel::CM_GRAY ); setChannelOrder( ( mNumComponents == 2 ) ? ImageIo::ChannelOrder::YA : ImageIo::ChannelOrder::Y ); if( mNumComponents == 2 ) mChannelNames = { "Y", "A" }; else mChannelNames = { "Y" }; break; default: throw ImageIoExceptionIllegalColorModel(); } // TODO: consider supporting half float and uint types as well setDataType( ImageIo::DataType::FLOAT32 ); mData.resize( mHeight * imageSource->getWidth() * mNumComponents ); }
ImageSourceFileTinyExr::ImageSourceFileTinyExr( DataSourceRef dataSource, ImageSource::Options /*options*/ ) { mExrImage.reset( new EXRImage ); const char *error; InitEXRImage( mExrImage.get() ); int status = 0; if( dataSource->isFilePath() ) { status = ParseMultiChannelEXRHeaderFromFile( mExrImage.get(), dataSource->getFilePath().string().c_str(), &error ); if( status != 0 ) throw ImageIoExceptionFailedLoadTinyExr( string( "Failed to parse OpenEXR header; Error message: " ) + error ); status = LoadMultiChannelEXRFromFile( mExrImage.get(), dataSource->getFilePath().string().c_str(), &error ); if( status != 0 ) throw ImageIoExceptionFailedLoadTinyExr( string( "Failed to parse OpenEXR file; Error message: " ) + error ); } else { BufferRef buffer = dataSource->getBuffer(); status = ParseMultiChannelEXRHeaderFromMemory( mExrImage.get(), (const unsigned char*)buffer->getData(), &error ); if( status != 0 ) throw ImageIoExceptionFailedLoadTinyExr( string( "Failed to parse OpenEXR header; Error message: " ) + error ); status = LoadMultiChannelEXRFromMemory( mExrImage.get(), (const unsigned char*)buffer->getData(), &error ); if( status != 0 ) throw ImageIoExceptionFailedLoadTinyExr( string( "Failed to parse OpenEXR file; Error message: " ) + error ); } // verify that the channels are all the same size; currently we don't support variably sized channels int pixelType = mExrImage->pixel_types[0]; for( int c = 1; c < mExrImage->num_channels; ++c ) { if( pixelType != mExrImage->pixel_types[c] ) throw ImageIoExceptionFailedLoadTinyExr( "TinyExr: heterogneous channel data types not supported" ); } switch( pixelType ) { case TINYEXR_PIXELTYPE_HALF: setDataType( ImageIo::FLOAT16 ); break; case TINYEXR_PIXELTYPE_FLOAT: setDataType( ImageIo::FLOAT32 ); break; default: throw ImageIoExceptionFailedLoadTinyExr( "TinyExr: Unknown data type" ); break; } setSize( mExrImage->width, mExrImage->height ); switch( mExrImage->num_channels ) { case 3: setColorModel( ImageIo::CM_RGB ); setChannelOrder( ImageIo::ChannelOrder::RGB ); break; case 4: setColorModel( ImageIo::CM_RGB ); setChannelOrder( ImageIo::ChannelOrder::RGBA ); break; default: throw ImageIoExceptionFailedLoadTinyExr( "TinyExr: Unsupported number of channels (" + to_string( mExrImage->num_channels ) + ")" ); } }
IntegralType::IntegralType(uint type) : AbstractType(createData<IntegralType>()) { d_func_dynamic()->setTypeClassId<IntegralType>(); setDataType(type); }
void BarWidget::loadWidgetInfo(DataFileParser *file) { DataWidget::loadWidgetInfo(file); // data type if(file->seekToNextBlock("barWType", BLOCK_WIDGET)) { file->read((char*)&m_numberType, sizeof(m_numberType)); setDataType(m_numberType); } // range if(file->seekToNextBlock("barWRangeDouble", BLOCK_WIDGET)) { double min = file->readVal<double>(); double max = file->readVal<double>(); m_bar->setScale(min, max); } else if(file->seekToNextBlock("barWRange", BLOCK_WIDGET)) { double min = file->readVal<int>(); double max = file->readVal<int>(); m_bar->setScale(min, max); } //rotation if(file->seekToNextBlock("barWRotation", BLOCK_WIDGET)) { file->read((char*)&m_rotation, sizeof(m_rotation)); rotate(m_rotation); } // visibility if(file->seekToNextBlock("barWVisibility", BLOCK_WIDGET)) { showScale(file->readVal<bool>()); showVal(file->readVal<bool>()); } // colors if(file->seekToNextBlock("barWColors", BLOCK_WIDGET)) { QPalette p = m_bar->palette(); Q_ASSERT(COLOR_COUNT == 3); for(int i = 0; i < COLOR_COUNT; ++i) p.setColor(roles[i], QColor(file->readString())); m_bar->setPalette(p); } // alarm if(file->seekToNextBlock("barWAlarm", BLOCK_WIDGET)) { bool enable = file->readVal<bool>(); m_bar->setAlarmLevel(file->readVal<double>()); m_bar->setAlarmEnabled(enable); m_alarmEnable->setChecked(m_bar->alarmEnabled()); m_alarmLevel->setEnabled(m_bar->alarmEnabled()); } // formula if(file->seekToNextBlock("barWFormula", BLOCK_WIDGET)) m_eval.setFormula(file->readString()); }
GoIntegralType::GoIntegralType(uint type) : IntegralType(createData<GoIntegralType>()) { setDataType(type); setModifiers(ConstModifier); }
void ImageTargetFileWic::setupPixelFormat( const GUID &guid ) { if( guid == GUID_WICPixelFormat24bppBGR ) { setChannelOrder( ImageIo::BGR ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT8 ); } else if( guid == GUID_WICPixelFormat24bppRGB ) { setChannelOrder( ImageIo::RGB ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT8 ); } else if( guid == GUID_WICPixelFormat32bppBGR ) { setChannelOrder( ImageIo::BGRX ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT8 ); } else if( guid == GUID_WICPixelFormat32bppBGRA ) { setChannelOrder( ImageIo::BGRA ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT8 ); } else if( guid == GUID_WICPixelFormat32bppPBGRA ) { setChannelOrder( ImageIo::BGRA ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT8 );// mIsPremultipliedAlpha = true; } else if( guid == GUID_WICPixelFormat48bppRGB ) { setChannelOrder( ImageIo::RGB ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT16 ); } else if( guid == GUID_WICPixelFormat64bppRGBA ) { setChannelOrder( ImageIo::RGBA ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT16 ); } else if( guid == GUID_WICPixelFormat64bppPRGBA ) { setChannelOrder( ImageIo::RGBA ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::UINT16 ); // mIsPremultipliedAlpha = true; } else if( guid == GUID_WICPixelFormat128bppRGBFloat ) { setChannelOrder( ImageIo::RGB ); setColorModel( ImageIo::CM_RGB ); setDataType( ImageIo::FLOAT32 ); } else if( guid == GUID_WICPixelFormat8bppGray ) { setChannelOrder( ImageIo::Y ); setColorModel( ImageIo::CM_GRAY ); setDataType( ImageIo::UINT8 ); } else if( guid == GUID_WICPixelFormat16bppGray ) { setChannelOrder( ImageIo::Y ); setColorModel( ImageIo::CM_GRAY ); setDataType( ImageIo::UINT16 ); } else if( guid == GUID_WICPixelFormat32bppGrayFloat ) { setChannelOrder( ImageIo::Y ); setColorModel( ImageIo::CM_GRAY ); setDataType( ImageIo::FLOAT32 ); } else throw ImageIoExceptionFailedLoad(); int32_t bitsPerComponent; bool writingAlpha = hasAlpha(); bool isFloat = true; switch( getDataType() ) { case ImageIo::UINT8: bitsPerComponent = 8; isFloat = false; break; case ImageIo::UINT16: bitsPerComponent = 16; isFloat = false; break; default: bitsPerComponent = 32; isFloat = true; } uint8_t numChannels; switch( getColorModel() ) { case ImageIo::CM_GRAY: numChannels = ( writingAlpha ) ? 2 : 1; break; default: numChannels = ( writingAlpha ) ? 4 : 3; } int32_t bitsPerPixel = numChannels * bitsPerComponent; mRowBytes = ( mWidth * ( bitsPerPixel / 8 ) + 3 ) & ~3; return; }
//WARNING: event ID must match enum ddDataType!!! this event was created on view void ddTextTableItemFigure::OnGenericPopupClick(wxCommandEvent &event, hdDrawingView *view) { wxTextEntryDialog *nameDialog = NULL; ddPrecisionScaleDialog *numericDialog = NULL; wxString tmpString; int answer; int tmpprecision; long tmpvalue; hdRemoveDeleteDialog *delremDialog = NULL; switch(event.GetId()) { case MNU_DDADDCOLUMN: nameDialog = new wxTextEntryDialog(view, wxT("New column name"), wxT("Add a column")); answer = nameDialog->ShowModal(); if (answer == wxID_OK) { tmpString = nameDialog->GetValue(); getOwnerColumn()->getOwnerTable()->addColumn(view->getIdx(), new ddColumnFigure(tmpString, getOwnerColumn()->getOwnerTable())); view->notifyChanged(); } delete nameDialog; break; case MNU_DELCOLUMN: answer = wxMessageBox(wxT("Are you sure you wish to delete column ") + getText(true) + wxT("?"), wxT("Delete column?"), wxYES_NO | wxNO_DEFAULT, view); if (answer == wxYES) { getOwnerColumn()->getOwnerTable()->removeColumn(view->getIdx(), getOwnerColumn()); view->notifyChanged(); } break; case MNU_AUTONAMCOLUMN: getOwnerColumn()->activateGenFkName(); getOwnerColumn()->getFkSource()->syncAutoFkName(); view->notifyChanged(); break; case MNU_RENAMECOLUMN: nameDialog = new wxTextEntryDialog(view, wxT("New column name"), wxT("Rename Column"), getText()); nameDialog->ShowModal(); if(getOwnerColumn()->isGeneratedForeignKey()) //after a manual user column rename, deactivated automatic generation of fk name. getOwnerColumn()->deactivateGenFkName(); setText(nameDialog->GetValue()); delete nameDialog; view->notifyChanged(); break; case MNU_NOTNULL: if(getOwnerColumn()->isNotNull()) getOwnerColumn()->setColumnOption(null); else getOwnerColumn()->setColumnOption(notnull); view->notifyChanged(); break; case MNU_PKEY: if(getOwnerColumn()->isPrimaryKey()) { getOwnerColumn()->disablePrimaryKey(); } else { getOwnerColumn()->enablePrimaryKey(); getOwnerColumn()->setColumnOption(notnull); } view->notifyChanged(); break; case MNU_UKEY: getOwnerColumn()->toggleColumnKind(uk, view); view->notifyChanged(); break; case MNU_TYPESERIAL: setDataType(dt_serial); //Should use setDataType always to set this value to allow fk to work flawlessly recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); view->notifyChanged(); break; case MNU_TYPEBOOLEAN: setDataType(dt_boolean); recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); view->notifyChanged(); break; case MNU_TYPEINTEGER: setDataType(dt_integer); recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); view->notifyChanged(); break; case MNU_TYPEMONEY: setDataType(dt_money); recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); view->notifyChanged(); break; case MNU_TYPEVARCHAR: setDataType(dt_varchar); tmpprecision = wxGetNumberFromUser(_("Varchar size"), _("Size for varchar datatype"), _("Varchar size"), getPrecision(), 0, 255, view); if (tmpprecision >= 0) { setPrecision(tmpprecision); setScale(-1); } recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); view->notifyChanged(); break; case MNU_TYPEOTHER: answer = wxGetSingleChoiceIndex(wxT("New column datatype"), wxT("Column Datatypes"), dataTypes(), view); if(answer >= 0) { view->notifyChanged(); if(answer == dt_varchar || answer == dt_bit || answer == dt_char || answer == dt_interval || answer == dt_varbit) { tmpprecision = wxGetNumberFromUser(_("datatype size"), _("Size for datatype"), _("size"), getPrecision(), 0, 255, view); if (tmpprecision >= 0) { setPrecision(tmpprecision); setScale(-1); } recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); } if(answer == dt_numeric) { numericDialog = new ddPrecisionScaleDialog( view, NumToStr((long)getPrecision()), NumToStr((long)getScale())); numericDialog->ShowModal(); numericDialog->GetValue1().ToLong(&tmpvalue); setPrecision(tmpvalue); numericDialog->GetValue2().ToLong(&tmpvalue); setScale(tmpvalue); delete numericDialog; recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); } setDataType( (ddDataType) answer ); recalculateDisplayBox(); getOwnerColumn()->displayBoxUpdate(); getOwnerColumn()->getOwnerTable()->updateTableSize(); } break; case MNU_TYPEPKEY_CONSTRAINTNAME: tmpString = wxGetTextFromUser(wxT("New name of primary key:"), getOwnerColumn()->getOwnerTable()->getPkConstraintName(), getOwnerColumn()->getOwnerTable()->getPkConstraintName(), view); if(tmpString.length() > 0) { getOwnerColumn()->getOwnerTable()->setPkConstraintName(tmpString); view->notifyChanged(); } break; case MNU_TYPEUKEY_CONSTRAINTNAME: answer = wxGetSingleChoiceIndex(wxT("Select Unique Key constraint to edit name"), wxT("Select Unique Constraint to edit name:"), getOwnerColumn()->getOwnerTable()->getUkConstraintsNames(), view); if(answer >= 0) { tmpString = wxGetTextFromUser(wxT("Change name of Unique Key constraint:"), getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer), getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer), view); if(tmpString.length() > 0) { getOwnerColumn()->getOwnerTable()->getUkConstraintsNames().Item(answer) = tmpString; view->notifyChanged(); } } break; case MNU_DELTABLE: delremDialog = new hdRemoveDeleteDialog(wxT("Are you sure you wish to delete table ") + getOwnerColumn()->getOwnerTable()->getTableName() + wxT("?"), wxT("Delete table?"), view); answer = delremDialog->ShowModal(); ddTableFigure *table = getOwnerColumn()->getOwnerTable(); if (answer == DD_DELETE) { ddDrawingEditor *editor = (ddDrawingEditor *) view->editor(); //Unselect table at all diagrams editor->removeFromAllSelections(table); //Drop foreign keys with this table as origin or destination table->processDeleteAlert(view->getDrawing()); //Drop table editor->deleteModelFigure(table); editor->getDesign()->refreshBrowser(); view->notifyChanged(); } else if(answer == DD_REMOVE) { ddDrawingEditor *editor = (ddDrawingEditor *) view->editor(); editor->getExistingDiagram(view->getIdx())->removeFromSelection(table); editor->getExistingDiagram(view->getIdx())->remove(table); view->notifyChanged(); } delete delremDialog; break; } }
RKVariable::RKVariable (RContainerObject *parent, const QString &name) : RObject (parent, name) { RK_TRACE (OBJECTS); type = Variable; setDataType (RObject::DataNumeric); }