void ImageHistogram<T>::toAscii( QTextStream& out ) const { const QString LINE_END( "\n"); QString centerStr( "#Bin Center("); casa::Unit unit = ImageHistogram::m_image->units(); QString unitStr( unit.getName().c_str()); centerStr.append( unitStr + ")"); out << centerStr << "Count"; out << LINE_END; out.flush(); int count = m_xValues.size(); for ( int i = 0; i < count; i++ ) { out << QString::number(m_xValues[i]) << QString::number( m_yValues[i]); out << LINE_END; out.flush(); } }
PRBool SVGLength::SetValueFromString(const nsAString &aValue) { float tmpValue; PRUint16 tmpUnit; NS_ConvertUTF16toUTF8 value(aValue); const char *str = value.get(); while (*str != '\0' && IsSVGWhitespace(*str)) { ++str; } char *unit; tmpValue = float(PR_strtod(str, &unit)); if (unit != str && NS_finite(tmpValue)) { char *theRest = unit; if (*unit != '\0' && !IsSVGWhitespace(*unit)) { while (*theRest != '\0' && !IsSVGWhitespace(*theRest)) { ++theRest; } nsCAutoString unitStr(unit, theRest - unit); tmpUnit = GetUnitTypeForString(unitStr.get()); if (tmpUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN) { // nsSVGUtils::ReportToConsole return PR_FALSE; } } else { tmpUnit = nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER; } while (*theRest && IsSVGWhitespace(*theRest)) { ++theRest; } if (!*theRest) { mValue = tmpValue; mUnit = tmpUnit; return PR_TRUE; } } return PR_FALSE; }
casa::ImageRegion* ImageRegionGenerator::_makeRegionRectangle( casa::ImageInterface<casa::Float> * image, const QRectF& outlineBox){ casa::ImageRegion* imageRegion = nullptr; if ( image ){ casa::Vector<casa::Int> dispAxes(2); const casa::CoordinateSystem &cs = image->coordinates( ); int directionIndex = cs.findCoordinate( casa::Coordinate::DIRECTION ); if ( directionIndex >= 0 ){ casa::Vector<casa::Int> dirPixelAxis = cs.pixelAxes(directionIndex); dispAxes(0) = dirPixelAxis[0]; dispAxes(1) = dirPixelAxis[1]; casa::Vector<casa::Quantum<casa::Double> > qbrc(2); casa::Vector<casa::Quantum<casa::Double> > qtlc(2); QPointF tlc = outlineBox.topLeft(); QPointF brc = outlineBox.bottomRight(); bool blcValid = false; casa::Vector<casa::Double> brcWorld = _toWorld( cs, brc.x(), brc.y(), &blcValid ); bool trcValid = false; casa::Vector<casa::Double> tlcWorld = _toWorld( cs, tlc.x(), tlc.y(), &trcValid ); if ( blcValid && trcValid ){ casa::String unitStr( RAD_UNITS.toStdString().c_str() ); qtlc[0] = casa::Quantum<casa::Double>( tlcWorld[0], unitStr ); qtlc[1] = casa::Quantum<casa::Double>( tlcWorld[1], unitStr ); qbrc[0] = casa::Quantum<casa::Double>( brcWorld[0], unitStr ); qbrc[1] = casa::Quantum<casa::Double>( brcWorld[1], unitStr ); try { casa::WCBox box( qtlc, qbrc, casa::IPosition(dispAxes), cs, casa::Vector<casa::Int>() ); imageRegion = new casa::ImageRegion(box); } catch( const casa::AipsError& error ) { qDebug() << "Could not make image region error="<<error.getMesg().c_str(); } } } } return imageRegion; }
// --------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddMMCItemToLbxL // --------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddMMCItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString( textItemBuf->Des() ); HBufC* textItemBuf2 = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString2( textItemBuf2->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: switch ( aDriveInfo.iDriveStatus ) { case EDriveNotReady: { itemString.Format( KImageHeader, EIconMMCUnavailable ); break; } case EDriveLocked: { itemString.Format( KImageHeader, EIconMMCLocked ); break; } default: // Normal condition { itemString.Format( KImageHeader, EIconMMC ); break; } } itemString.Append( KTabChar ); // 1st row text: if( ( aDriveInfo.iDriveStatus == EDriveOK ) && ( aDriveInfo.iVolumeLabel.Length() > 0 ) ) { StringLoader::Format( textString2, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( textString, textString2, KIndexSecond, aDriveInfo.iVolumeLabel ); } else if ( aDriveInfo.iDriveStatus == EDriveNotReady ) { //textString.Format( // *iLocStringArray[ ETextMMCUnavailable ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCUnavailable ], KNoIndex, driveUnit.Name() ); } else if( aDriveInfo.iDriveStatus == EDriveLocked ) { //textString.Format( // *iLocStringArray[ ETextMMCLocked ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCLocked ], KNoIndex, driveUnit.Name() ); } else { // Use default drive description //textString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); break; } case ELayoutSettingPage: { // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { // Append drive name if it has one //itemString.Format( // *iLocStringArray[ ETextMMCNamed ], // driveUnit.Name(), // aDriveInfo.iVolumeLabel // ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( itemString, textString, KIndexSecond, aDriveInfo.iVolumeLabel ); } else { //itemString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() // ); StringLoader::Format( itemString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } break; } case ELayoutDoublePopup: { // A-column icon: if( aDriveInfo.iDriveStatus == EDriveNotReady ) { itemString.Format( KImageHeader, EIconMMCUnavailable ); } else { itemString.Format( KImageHeader, EIconMMC ); } itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iVolumeLabel.Length() > 0 ) { StringLoader::Format( textString2, *iLocStringArray[ ETextMMCNamed ], KIndexFirst, driveUnit.Name() ); StringLoader::Format( textString, textString2, KIndexSecond, aDriveInfo.iVolumeLabel ); } else { // Use default drive description //textString.Format( // *iLocStringArray[ ETextMMCDefaultName ], // driveUnit.Name() // ); StringLoader::Format( textString, *iLocStringArray[ ETextMMCDefaultName ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); itemString.Append( KTabChar ); // 2nd row text: switch( aDriveInfo.iDriveStatus ) { case EDriveNotReady: { itemString.Append( *iLocStringArray[ ETextMMCUnavailable ] ); break; } case EDriveLocked: { itemString.Append( *iLocStringArray[ ETextMMCLocked ] ); break; } case EDriveOK: default: { HBufC* buffer; TInt64 freeSpace = aDriveInfo.iDiskSpace; if ( freeSpace >= 0 ) { buffer = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr unitStr( buffer->Des() ); AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); } else { // Disk space is unavailable buffer = StringLoader::LoadLC( R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, iCoeEnv); } itemString.Append( *buffer );//Free mem text CleanupStack::PopAndDestroy( buffer ); break; } } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::PopAndDestroy( 2 ); // textItemBuf2, textItemBuf CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }
// -------------------------------------------------------------------------- // CAknMemorySelectionModelMultiDrive::AddInternalStorageItemToLbxL // // // -------------------------------------------------------------------------- // void CAknMemorySelectionModelMultiDrive::AddInternalStorageItemToLbxL( const TCFDDriveInfo& aDriveInfo ) { HBufC* lbxItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr itemString( lbxItemBuf->Des() ); HBufC* textItemBuf = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr textString( textItemBuf->Des() ); TDriveUnit driveUnit( aDriveInfo.iDriveNumber ); // Item text is affected by layout switch( iLayout ) { case ELayoutPopupMenu: { // A-column icon: if( aDriveInfo.iDriveStatus == EDriveOK ) { itemString.Format( KImageHeader, EIconInternalMassStorage ); } else { itemString.Format( KImageHeader, EIconInternalMassStorageUnavailable ); } itemString.Append( KTabChar ); // 1st row text: if( aDriveInfo.iDriveStatus == EDriveOK ) { StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); } else { StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorageUnavailable ], KNoIndex, driveUnit.Name() ); } itemString.Append( textString ); break; } case ELayoutSettingPage: { // 1st row text: StringLoader::Format( itemString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); break; } case ELayoutDoublePopup: { // A-column icon: itemString.Format( KImageHeader, EIconInternalMassStorage ); itemString.Append( KTabChar ); // 1st row text: StringLoader::Format( textString, *iLocStringArray[ ETextInternalMassStorage ], KNoIndex, driveUnit.Name() ); itemString.Append( textString ); itemString.Append( KTabChar ); // 2nd row text: if ( aDriveInfo.iDriveStatus == EDriveOK ) { HBufC* buffer; TInt64 freeSpace = aDriveInfo.iDiskSpace; if ( freeSpace >= 0 ) { buffer = HBufC::NewLC( KListBoxEntryMaxLength ); TPtr unitStr( buffer->Des() ); AknCFDUtility::SetSecondRowTextL( freeSpace, unitStr ); } else { // Disk space is unavailable buffer = StringLoader::LoadLC( R_CFD_QTN_MEMC_SPACE_NOT_AVAILABLE, iCoeEnv); } itemString.Append( *buffer );//Free mem text CleanupStack::PopAndDestroy( buffer ); } else { itemString.Append( *iLocStringArray[ ETextInternalMassStorageUnavailable ] ); } break; } } // Finally!: append the formatted string to listbox User::LeaveIfError( iListBoxArray.Append( lbxItemBuf ) ); CleanupStack::PopAndDestroy( textItemBuf ); CleanupStack::Pop( lbxItemBuf ); _LOG1( "[CAknMemorySelectionModelMultiDrive] Item string added to lbx array: %S", &itemString ); _LOG1( "itemString length=%d", itemString.Length() ); }