// -----------------------------------------------------------------------------
// TGlxCommandFactory::DeleteLocationCommandLC
// -----------------------------------------------------------------------------
//	
EXPORT_C CMPXCommand* TGlxCommandFactory::DeleteLocationCommandLC( 
		const CMPXCollectionPath& aSourcePath)
    {
    CMPXCommand* command = BasicCommandLC(KGlxCommandIdSet, aSourcePath);
    
    // Set command id
    command->SetTObjectValueL<const TCoordinate>(KGlxMediaGeneralLocation, TCoordinate());    
    
    return command;
    }
示例#2
0
TCoordinate TWidget::GetScreenPosition() const {
    const auto currentParent = parent.lock();
    if (currentParent != nullptr) {
        TPadding innerBorder = currentParent->GetInnerBorder();
        return position + currentParent->GetScreenPosition() +
               TCoordinate(innerBorder.left, innerBorder.top);
    } else {
        return position;
    }
}
示例#3
0
TCoordinate TMaze::Random() // Creates random coordinte in the maze
{
	TCoordinate p;

	do
	{
		p = TCoordinate(
		 random(MazeSize),
		 random(MazeSize),
		 random(MazeSize)
		);
	}
	while (p == Cube); // Until p != current coordinate

	return p;
}
void TAbstractTextBox::_draw(TRenderTarget& target) {
    if (needsRedraw == true) {
        TRenderTarget& localTarget = renderImage.getRenderTarget();
        localTarget.clear();

        sf::RectangleShape innerBorder( sf::Vector2f(size.x, size.y) );
        innerBorder.setFillColor(_currentColor());

        if (0.f < borderSize) {
            innerBorder.setOutlineColor(_currentBorderColor());
            innerBorder.setOutlineThickness(borderSize);
        }
        localTarget.draw(innerBorder);

        if (text->GetText().empty() == false) {
            text->Draw(localTarget, TCoordinate(borderSize, borderSize));
        }

        renderImage.createDrawingObject();
        needsRedraw = false;
    }

    const TCoordinate position = GetScreenPosition();
    renderImage.getDrawingObject().setPosition(position.x, position.y);
    target.draw(renderImage.getDrawingObject());

#if defined(_DEBUG)
    if (Debug::show_frames() == true) {
        sf::RectangleShape boundingRect( sf::Vector2f(size.x, size.y) );
        boundingRect.setFillColor(sf::Color(0, 255 - 55 * mouseOver, 0, 128));
        boundingRect.setPosition(position.x, position.y);
        target.draw(boundingRect);

        sf::Text rectText;
        rectText.setString(name);
        rectText.setPosition(position.x, position.y);
        target.draw(rectText);
    }
#endif
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
void CPosLmGpxParser::SetContentL( TPosXmlTagType aTag, const TDesC& aContent )
    {
    switch (aTag)
        {
        // landmarkCollection Tags
        case EPosXmlLmCollName:
            AddCollectionDataL( EPosLmCollDataCollectionName, aContent );
            break;
        case EPosXmlLmCollDescription:
            AddCollectionDataL( EPosLmCollDataCollectionDescription, aContent );
            break;
        // landmark Tags
        case EPosXmlLandmark:
            {
            if ( !Math::IsNaN( iParsedLatitude ) && !Math::IsNaN( iParsedLongitude ) )
                {
                TLocality loc(
                    TCoordinate(
                        iParsedLatitude, 
                        iParsedLongitude,
                        iParsedAltitude), 
                    iParsedHorAcc, 
                    iParsedVertAcc);
                
                iWorkingLandmark->SetPositionL(loc);
                }

            TBuf<5> num;
            num.Num(iNoOfMediaLinks);
            iWorkingLandmark->SetPositionFieldL(EPositionFieldMediaLinks, num);

            // v1.0 media links
            if ( iReadUrl && iGpxVersion == EGpxVersion10 )
                {
                SetContentL( EPosXmlLmMediaLink, KNullDesC );
                }
            
            HandleLandmarkParsedL();
            break;
            }
        case EPosXmlLmName:
            iWorkingLandmark->SetLandmarkNameL( aContent.Left( KPosLmMaxTextFieldLength ) );
            break;
        case EPosXmlLmDescription:
            iWorkingLandmark->SetLandmarkDescriptionL( aContent.Left( KPosLmMaxDescriptionLength ) );
            break;
        case EPosXmlLmDescription2:
            iWorkingLandmark->SetPositionFieldL( EPositionFieldComment, aContent.Left( KPosLmMaxTextFieldLength ) );
            break;
        
        case EPosXmlCoordAltitude:
            PosLmConverterUtils::DesToRealL(aContent, iParsedAltitude);
            break;
        case EPosXmlCoordHorizontalAcc:
            PosLmConverterUtils::DesToRealL(aContent, iParsedHorAcc);

            // Ensure horizontal acc is >= 0
            PosLmConverterUtils::AssertL(
                iParsedHorAcc >= 0 || Math::IsNaN( iParsedHorAcc ) );
            
            iParsedHorAcc *= KPosLmDopToAccuracyFactor;
            break;
        case EPosXmlCoordVerticalAcc:
            PosLmConverterUtils::DesToRealL( aContent, iParsedVertAcc );

            // Ensure vertical acc is >= 0
            PosLmConverterUtils::AssertL(
                iParsedVertAcc >= 0 || Math::IsNaN( iParsedVertAcc ) );

            iParsedVertAcc *= KPosLmDopToAccuracyFactor;
            break;

        // mediaLink Tag
        case EPosXmlMediaLinkUrl:
            PosLmConverterUtils::AssertL( PosLmConverterUtils::IsAnyUri( aContent ) );
            iReadUrl = aContent.AllocL();
            break;
        case EPosXmlMediaLinkMime:
            iReadMimeType = aContent.AllocL();
            break;
        case EPosXmlLmMediaLink:
            {
            HBufC* mediaLink = PosLmConverterUtils::ConcatenateMediaLinkLC(
                *iReadMimeType, *iReadUrl );
            iWorkingLandmark->SetPositionFieldL(static_cast<TPositionFieldId>
                (EPositionFieldMediaLinksStart + iNoOfMediaLinks),
                mediaLink->Left(KPosLmMaxTextFieldLength));
            iNoOfMediaLinks++;
            CleanupStack::PopAndDestroy(mediaLink);

            delete iReadMimeType;
            iReadMimeType = NULL;
            delete iReadUrl;
            iReadUrl = NULL;
            break;
            }

        // category Tags
        case EPosXmlCategoryName:
            PosLmImplExtension::SetCategoryIdL( *iWorkingCategory, iWorkingItemId );

            PosLmConverterUtils::AssertL( aContent.Length() > 0 );
            iWorkingCategory->SetCategoryNameL( aContent.Left( KPosLmMaxCategoryNameLength ) );

            iWorkingLandmark->AddCategoryL( iWorkingItemId++ );
            User::LeaveIfError( iCategories.Append( iWorkingCategory ) );
            iWorkingCategory = NULL;

            break;

        // Attributes    
        case EPosXmlCoordLatitude: // WayPoint attribute
            PosLmConverterUtils::DesToRealL(aContent, iParsedLatitude);

            // Ensure latitude is in valid range
            PosLmConverterUtils::AssertL(
                (iParsedLatitude <= KPosLmParserMaxLatitude &&
                iParsedLatitude >= KPosLmParserMinLatitude) ||
                Math::IsNaN(iParsedLatitude));
            break;

        case EPosXmlCoordLongitude: // WayPoint attribute
            PosLmConverterUtils::DesToRealL(aContent, iParsedLongitude);

            // Ensure latitude is in valid range
            PosLmConverterUtils::AssertL(
                (iParsedLongitude <= KPosLmParserMaxLongitude &&
                iParsedLongitude >= KPosLmParserMinLongitude) ||
                Math::IsNaN(iParsedLongitude));
            break;

        case EPosXmlVersion: 
            if ( aContent.Compare( KPosXmlVersionNum10 ) == 0 )
                {
                iGpxVersion = EGpxVersion10;
                }
            else // anything else is used as 1.1
                {
                iGpxVersion = EGpxVersion11;
                }
            break;

        default:
            break;
        }
    }
示例#6
0
TCoordinate IO::MousePos() {
    return TCoordinate(MouseX(), MouseY());
}
//
// Performes the test by connecting to MLFW  
// (and makes a number of Location requests if aFullTest is true
//
void DoTestL(TBool aFullTest, TInt aNumberOfRuns, TInt *aResult)
    {
    RPositionServer	posServer;
	TInt errorCode = errorCode = posServer.Connect();

    if (errorCode != KErrNone)
        {
        *aResult = KErrCouldNotConnect;
        return;
        }
    CleanupClosePushL(posServer);

    RPositioner positioner;


    // Full test means requesting position updates
    if (aFullTest)
        {
        TPositionInfo positionInfo = TPositionInfo();
        const TInt32 KUidMultiPsy = 0x01010176;
        TUid uidMultiPsy;
        uidMultiPsy.iUid = KUidMultiPsy;
        errorCode = positioner.Open(posServer, uidMultiPsy);
        
        if (errorCode != KErrNone) 
        {
            *aResult = errorCode;
            return;
        }
        CleanupClosePushL(positioner);
        
        _LIT(KService ,"Service");
        errorCode = positioner.SetRequestor(CRequestor::ERequestorService,
            CRequestor::EFormatApplication, KService);
        
        if (errorCode != KErrNone)
        {
            *aResult = 1001;
            return;
        }
        
        TRequestStatus status;
        TLocality loca(TCoordinate(0,0,0),0);
        TPosition pos(loca, TTime(0));

        for (TInt i = 0; i < aNumberOfRuns; i++)
        {
            positionInfo.SetPosition(pos);
            positioner.NotifyPositionUpdate(positionInfo, status);
            User::WaitForRequest(status);
            TInt err = status.Int();
            if (err != KErrNone)
            {
                *aResult = err;
            }
            TPosition result;
            positionInfo.GetPosition(result);
            
            //sanity check
            if (result.Latitude() == pos.Latitude() ||
                result.Longitude() == pos.Longitude() ||
                result.Altitude() == pos.Altitude())
            {
                //_LIT(KErrorPositon, "ERROR:: The postion was not updated");
                errorCode = 1005;
            }   
        }
        positioner.Close();
        CleanupStack::PopAndDestroy(&positioner);
    }
    
    posServer.Close();
    CleanupStack::PopAndDestroy(&posServer);
    }
示例#8
0
void TWidget::SetPosition(float x, float y) {
    SetPosition(TCoordinate(x, y));
}