/**
   * One-time setup in response to Application InitSignal.
   */
  void Create( Application& application )
  {
    Stage stage = Stage::GetCurrent();

    stage.KeyEventSignal().Connect(this, &TextLabelMultiLanguageExample::OnKeyEvent);
    stage.SetBackgroundColor( Color::WHITE );

    mTableView = Toolkit::TableView::New( NUMBER_OF_LANGUAGES, 1 );
    mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
    mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
    mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
    mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    mTableView.TouchSignal().Connect( this, &TextLabelMultiLanguageExample::OnTouch );
    stage.Add( mTableView );

    for( unsigned int index = 0u; index < NUMBER_OF_LANGUAGES; ++index )
    {
      const Language& language = LANGUAGES[index];

      TextLabel label = TextLabel::New();
      label.SetProperty( TextLabel::Property::MULTI_LINE, true );

      const std::string text = language.languageName + " " + language.languageRomanName + " " + language.text;
      label.SetProperty( TextLabel::Property::TEXT, text );

      mTableView.SetFitHeight( index );
      mTableView.AddChild( label, Toolkit::TableView::CellPosition( index, 0 ) );
    }
  }
Example #2
0
    //------------------------------------------------------------------------------
    /// ステージの記録を開始することを通知します。
    ///
    /// @param[in] aStage 現在実行しているステージを表す Stage クラスへの参照。
    void RecordStage::writeStart(const Stage& aStage)
    {
#ifdef DEBUG
        mField.set(aStage.field());
        mItems.set(aStage.items());
#endif
    }
void DynamicsWorld::Initialize(Stage& stage, Integration::DynamicsFactory& dynamicsFactory, DynamicsWorldConfigPtr config)
{
    // Create shader for debug drawing
    const std::string debugDrawVertexShader(
        "attribute lowp vec4 aColor;\n"
        "varying mediump vec4 vColor;\n"
        "void main()\n"
        "{\n"
        "  vColor = aColor;\n"
        "  gl_Position = uMvpMatrix * vec4(aPosition, 1.0);\n"
        "}\n" );

    const std::string debugDrawFragmentShader(
        "varying mediump vec4 vColor;\n"
        "void main()\n"
        "{\n"
        "  gl_FragColor = vColor;\n"
        "}\n" );

    mDebugShader = ShaderEffect::New(debugDrawVertexShader, debugDrawFragmentShader, GEOMETRY_TYPE_IMAGE, Dali::ShaderEffect::HINT_NONE);

    mDynamicsWorld = new SceneGraph::DynamicsWorld( stage.GetDynamicsNotifier(),
            stage.GetNotificationManager(),
            dynamicsFactory );

    Integration::DynamicsWorldSettings* worldSettings( new Integration::DynamicsWorldSettings(*config->GetSettings()) );
    const SceneGraph::Shader* shader( static_cast< const SceneGraph::Shader* >(mDebugShader->GetSceneObject()) );
    InitializeDynamicsWorldMessage( stage.GetUpdateManager(), mDynamicsWorld, worldSettings, shader );

    mGravity = config->GetGravity();
}
Example #4
0
void Boid::update_debug_mesh() const {
    Stage* stage = actor_->stage();
    assert(stage);

    auto mesh = stage->mesh(debug_mesh_).lock();

    auto& vd = mesh->submesh(normal_points_mesh_).vertex_data();
    auto& id = mesh->submesh(normal_points_mesh_).index_data();

    vd.clear();
    id.clear();

    vd.move_to_start();

    int i = 0;
    for(kglt::Vec3 p: normal_points_) {
        vd.position(p);
        vd.diffuse(kglt::Colour::red);
        vd.tex_coord0(kglt::Vec2());
        vd.tex_coord1(kglt::Vec2());
        vd.normal(kglt::Vec3());
        vd.move_next();

        id.index(i++);
    }

    id.done();
    vd.done();
}
Example #5
0
  void OnInit( Application& application )
  {
    // Create a ScrollView instance
    ScrollView scrollView = ScrollView::New();
    scrollView.SetParentOrigin( ParentOrigin::CENTER );
    Stage stage = Stage::GetCurrent();
    stage.Add(scrollView);

    // Set the size of scrollView; it covers the entire stage
    Size size = stage.GetSize();
    scrollView.SetSize(size);

    // Add actors to the ScrollView
    for( int i = 0; i < NUM_IMAGES; ++i )
    {
      AddImage( scrollView, size, i );
    }

    // The ScrollView contents are now draggable
    // To enforce horizontal-only scrolling, the Y axis ruler can be disabled
    RulerPtr rulerY = new DefaultRuler();
    rulerY->Disable();
    scrollView.SetRulerY( rulerY );

    // A domain can be applied to rulers to prevent scrolling beyond this boundary
    // In this case, to 4 times the width of the stage, allowing for 4 pages to be scrolled
    RulerPtr rulerX2 = new FixedRuler( size.width );
    rulerX2->SetDomain( RulerDomain( 0.0f, size.width*NUM_IMAGES ) );
    scrollView.SetRulerX( rulerX2 );

    // Connect key event signal
    stage.KeyEventSignal().Connect( this, &ScrollViewSample::OnKeyEvent );
  }
Example #6
0
void CascadeWriter::writeStages()
{
    xml.writeStartElement("stages");

    for (int i = 0; i < m_cascadeObj.stageNum(); i++)
    {
        QString stageStr = QString(" stage %1 ").arg(i);
        xml.writeComment(stageStr);

        Stage stage = m_cascadeObj.getStage(i);
        xml.writeStartElement("_");
        xml.writeTextElement("maxWeakCount", QString::number(stage.maxWeakCount()));
        xml.writeTextElement("stageThreshold", QString::number(stage.stageThreshold()));

        // write weak classifiers
        xml.writeStartElement("weakClassifiers");
        for (int j = 0; j < stage.maxWeakCount(); j++)
        {
            WeakClassifier wc = stage.getWeakClassifier(j);
            xml.writeStartElement("_");
            xml.writeTextElement("internalNodes", wc.internalNodes());
            xml.writeTextElement("leafValues", wc.leafValues());
            xml.writeEndElement();
        }
        xml.writeEndElement();

        xml.writeEndElement();
    }
    xml.writeEndElement();
}
int UtcDaliHoverMultipleRenderableActors(void)
{
  TestApplication application;
  Stage stage ( Stage::GetCurrent() );
  Vector2 stageSize ( stage.GetSize() );

  Actor parent = CreateRenderableActor();
  parent.SetSize( 100.0f, 100.0f );
  parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
  stage.Add(parent);

  Actor actor = CreateRenderableActor();
  actor.SetSize( 100.0f, 100.0f );
  actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
  parent.Add(actor);

  // Render and notify
  application.SendNotification();
  application.Render();

  // Connect to layer's hovered signal
  SignalData data;
  HoverEventFunctor functor( data );
  parent.HoveredSignal().Connect( &application, functor );
  actor.HoveredSignal().Connect( &application, functor );

  // Emit a started signal
  application.ProcessEvent( GenerateSingleHover( TouchPoint::Started, Vector2( 10.0f, 10.0f ) ) );
  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
  DALI_TEST_CHECK( actor == data.hoveredActor );
  END_TEST;
}
Example #8
0
int UtcDaliMagnifierFrameVisibility(void)
{
  ToolkitTestApplication application;

  Stage stage = Stage::GetCurrent();

  Magnifier view = Magnifier::New();
  stage.Add( view );

  application.SendNotification();
  application.Render();

  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::FRAME_VISIBILITY ).Get< bool >(), true, TEST_LOCATION );

  view.SetProperty( Magnifier::Property::FRAME_VISIBILITY, false );
  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::FRAME_VISIBILITY ).Get< bool >(), false, TEST_LOCATION );

  application.SendNotification();
  application.Render();

  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::FRAME_VISIBILITY ).Get< bool >(), false, TEST_LOCATION );

  view.SetProperty( Magnifier::Property::FRAME_VISIBILITY, true );
  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::FRAME_VISIBILITY ).Get< bool >(), true, TEST_LOCATION );

  application.SendNotification();
  application.Render();

  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::FRAME_VISIBILITY ).Get< bool >(), true, TEST_LOCATION );

  END_TEST;
}
Example #9
0
int UtcDaliStageKeepRenderingN(void)
{
  TestApplication application;

  Stage stage = Stage::GetCurrent();

  // Run core until it wants to sleep
  bool keepUpdating( true );
  while ( keepUpdating )
  {
    application.SendNotification();
    keepUpdating = application.Render( 1000.0f /*1 second*/ );
  }

  // Force rendering for the next 5 seconds
  stage.KeepRendering( -1.0f );

  application.SendNotification();

  // Test that core wants to sleep after 10 seconds
  keepUpdating = application.Render( 1000.0f /*1 second*/ );
  DALI_TEST_CHECK( !keepUpdating );

  END_TEST;
}
Example #10
0
int UtcDaliMagnifierSourcePosition(void)
{
  ToolkitTestApplication application;

  Stage stage = Stage::GetCurrent();

  Magnifier view = Magnifier::New();
  stage.Add( view );

  application.SendNotification();
  application.Render();

  Vector3 position( 100.0f, 200.0f, 300.0f );

  DALI_TEST_CHECK( view.GetProperty( Magnifier::Property::SOURCE_POSITION ).Get< Vector3 >() != position );

  view.SetProperty( Magnifier::Property::SOURCE_POSITION, position );
  application.SendNotification();
  application.Render();
  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::SOURCE_POSITION ).Get< Vector3 >(), position, TEST_LOCATION );

  view.SetProperty( Magnifier::Property::SOURCE_POSITION, Vector3::ONE );
  application.SendNotification();
  application.Render();
  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::SOURCE_POSITION ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );

  END_TEST;
}
Example #11
0
File: main.cpp Project: jejatu/3d
int main(int argc, char **argv) {
	init();
	stage.run(); // start the internal loop
	stage.dispose();

	return 0;
}
int InitNMCModule3AxisStatic		(int & iModules, Stage & stage, Path & path)
{
 
	iModules=stage.Initialize("COM4:");

	if (iModules < 3)
	{
		MessageBox(NULL,"3 servos not found","",MB_TASKMODAL | MB_SETFOREGROUND);
		return -1;
	}
	stage.Rotate(180.0);

//Set the group address for both controllers to 128
	stage.SetGroupAddress(128, eXAxis);
	SetScaling_3AxisStatic(stage);
	SetPIDGain_3AxisStatic(stage);
	ServoOnNMCModule3AxisStatic(stage);

//Set the required status items for the path control module
	stage.SetPathStatus();

//  ServoSetIoCtrl(1, IO1_IN | IO2_IN);
//	ServoSetIoCtrl(2, IO1_IN | IO2_IN);
//	ServoSetIoCtrl(3, IO1_IN | IO2_IN);

	return 0;
};
int TestPtToPtAndCoordOutPts()
{
	
	int iModule;
	int iError;
	double dX, dY, dZ;

	iError=InitNMCModule3Axis (iModule);

	g_stage.SetVel(3.0, 3.0, 3.0);
	g_stage.SetAccel(1.0, 1.0, 1.0);

//	g_stage.EnableAmp();
//	g_stage.ResetPos();
//	g_stage.SetPathStatus();

//Initialize path control module parameters
	g_stage.SetPathFreq(P_60HZ);
	g_stage.SetNumberOfPoints(75);
	g_stage.SetScale(15000.0, 15000.0, 15000.0);
	g_stage.SetPathAcceleration(0.175);
	g_stage.SetFeedrate(0.175);         //feedrate = 1.0 inches/second
	g_stage.SetTangentTolerance(10.0);  //continuous path tangent tolerence = 10 degrees
	g_stage.SetPathParams();     //acceleration = 1.0 inch/second/second
	g_stage.SetOrigin( 0.0, 0.0, 0.0 ); //set the origin to X = 0, Y = 0, Z = 0
	
//	g_stage.ClosePointsOut();

	return 0;
};
Example #14
0
int UtcDaliStageSignalWheelEventP(void)
{
  TestApplication application;
  Stage stage = Stage::GetCurrent();

  WheelEventSignalData data;
  WheelEventReceivedFunctor functor( data );
  stage.WheelEventSignal().Connect( &application, functor );

  Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u );
  application.ProcessEvent( event );

  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type );
  DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction );
  DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers );
  DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point );
  DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z );
  DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp );

  data.Reset();

  Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u );
  application.ProcessEvent( event2 );

  DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type );
  DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction );
  DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers );
  DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point );
  DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z );
  DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp );
  END_TEST;
}
Example #15
0
bool HitTest( Stage& stage, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface )
{
  bool wasHit( false );

  // Hit-test the system-overlay actors first
  SystemOverlay* systemOverlay = stage.GetSystemOverlayInternal();

  if ( systemOverlay )
  {
    RenderTaskList& overlayTaskList = systemOverlay->GetOverlayRenderTasks();
    LayerList& overlayLayerList = systemOverlay->GetLayerList();

    wasHit = HitTestForEachRenderTask( stage, overlayLayerList, overlayTaskList, screenCoordinates, results, hitTestInterface );
  }

  // Hit-test the regular on-stage actors
  if ( !wasHit )
  {
    RenderTaskList& taskList = stage.GetRenderTaskList();
    LayerList& layerList = stage.GetLayerList();

    wasHit = HitTestForEachRenderTask( stage, layerList, taskList, screenCoordinates, results, hitTestInterface );
  }
  return wasHit;
}
Example #16
0
void PcInfo::dumpOnePoint(const Stage& stage) const
{
    const Schema& schema = stage.getSchema();

    PointBuffer data(schema, 1);
    
    boost::scoped_ptr<StageSequentialIterator> iter(stage.createSequentialIterator(data));
    iter->skip(m_pointNumber);

    const boost::uint32_t numRead = iter->read(data);
    if (numRead != 1)
    {
        std::ostringstream oss;
        oss << "problem reading point number " << m_pointNumber;
        throw app_runtime_error(oss.str());
    }

    boost::property_tree::ptree tree = data.toPTree();
   
    std::ostream& ostr = m_outputStream ? *m_outputStream : std::cout;

    boost::property_tree::ptree output;
    output.add_child("point", tree.get_child("0"));
    if (m_useXML)
        write_xml(ostr, output);
    else
        write_json(ostr, tree.get_child("0"));
        
    return;
}
Example #17
0
  int MyKernel::execute()
  {
    PointTable table;
    StageFactory f;

    Stage * reader = f.createStage("readers.las");
    Options readerOptions;
    readerOptions.add("filename", m_input_file);
    reader->setOptions(readerOptions);

    Stage * filter = f.createStage("filters.decimation");
    Options filterOptions;
    filterOptions.add("step", 10);
    filter->setOptions(filterOptions);
    filter->setInput(*reader);

    Stage * writer = f.createStage("writers.text");
    Options writerOptions;
    writerOptions.add("filename", m_output_file);
    writer->setOptions(writerOptions);
    writer->setInput(*filter);
    writer->prepare(table);
    writer->execute(table);

    return 0;
  }
static void UtcDaliKeyInputFocusManagerIsKeyboardListener()
{
  ToolkitTestApplication application;
  Stage stage = Stage::GetCurrent();

  tet_infoline(" UtcDaliKeyInputFocusManagerIsKeyboardListener");

  KeyInputFocusManager manager = KeyInputFocusManager::Get();
  DALI_TEST_CHECK(manager);

  PushButton pushButton1 = PushButton::New();
  PushButton pushButton2 = PushButton::New();
  stage.Add( pushButton1 );
  stage.Add( pushButton2 );

  manager.SetFocus(pushButton1);
  DALI_TEST_CHECK(pushButton1 == manager.GetCurrentFocusControl());

  manager.SetFocus(pushButton2);
  DALI_TEST_CHECK(pushButton2 == manager.GetCurrentFocusControl());

  DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton1));
  DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2));

  manager.RemoveFocus(pushButton2);
  DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2));

  manager.RemoveFocus(pushButton1);
  DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton1));

  manager.SetFocus(pushButton2);
  DALI_TEST_CHECK(manager.IsKeyboardListener(pushButton2));
  pushButton2.ClearKeyInputFocus();
  DALI_TEST_CHECK(!manager.IsKeyboardListener(pushButton2));
}
Example #19
0
void PipelineManager::prepare() const
{
    validateStageOptions();
    Stage *s = getStage();
    if (s)
       s->prepare(m_table);
}
void CacheEntryInfo::
throwHelpfulOutOfDateMessage(const StateImpl& stateImpl,
                             const char* funcName) const {
    const PerSubsystemInfo& subsys = stateImpl.getSubsystem(m_myKey.first);
    assert(&subsys.getCacheEntryInfo(m_myKey.second) == this);
    const Stage current = subsys.getCurrentStage();
    SimTK_STAGECHECK_GE_ALWAYS(current, getDependsOnStage(), funcName);

    const StageVersion version = subsys.getStageVersion(m_dependsOnStage);

    SimTK_ERRCHK4_ALWAYS(version == m_dependsOnVersionWhenLastComputed,
                            funcName,
        "State Cache entry was out of date at Stage %s. This entry depends "
        "on version %lld of Stage %s but was last updated at version %lld.",
        current.getName().c_str(), version, 
        getDependsOnStage().getName().c_str(),
        m_dependsOnVersionWhenLastComputed);

    SimTK_ASSERT_ALWAYS(!m_isUpToDateWithPrerequisites,
    "CacheEntryInfo::throwHelpfulOutOfDateMessage(): not out of date???");

    SimTK_ERRCHK_ALWAYS(m_isUpToDateWithPrerequisites, funcName,
        "State Cache entry was out of date with respect to one of its "
        "explicit prerequisites.");
}
Example #21
0
  // The Init signal is received once (only) during the Application lifetime
  void Create( Application& application )
  {
    Stage stage = Stage::GetCurrent();
    stage.SetBackgroundColor( Color::WHITE );
    stage.KeyEventSignal().Connect(this, &EmojiExample::OnKeyEvent);

    mTableView = Toolkit::TableView::New( NUMBER_OF_EMOJIS, 1 );
    mTableView.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
    mTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
    mTableView.SetParentOrigin( ParentOrigin::TOP_LEFT );
    mTableView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
    mTableView.TouchedSignal().Connect( this, &EmojiExample::OnTouchEvent );
    stage.Add( mTableView );

    for( unsigned int index = 0u; index < NUMBER_OF_EMOJIS; ++index )
    {
      const Emoji& emoji = EMOJIS[index];
      const std::string text = emoji.mUTF8 + " " + emoji.mDescription;

      TextLabel label = TextLabel::New( text );
      label.SetParentOrigin( ParentOrigin::TOP_CENTER );
      label.SetAnchorPoint( AnchorPoint::TOP_CENTER );
      label.SetProperty( TextLabel::Property::MULTI_LINE, true );

      mTableView.SetFitHeight( index );
      mTableView.AddChild( label, Toolkit::TableView::CellPosition( index, 0 ) );
    }
  }
Example #22
0
int UtcDaliMagnifierMagnificationFactor(void)
{
  ToolkitTestApplication application;

  Stage stage = Stage::GetCurrent();

  Magnifier view = Magnifier::New();
  stage.Add( view );

  application.SendNotification();
  application.Render();

  float magnificationFactor( 200.0f );

  DALI_TEST_CHECK( view.GetProperty( Magnifier::Property::MAGNIFICATION_FACTOR ).Get< float >() != magnificationFactor );

  view.SetProperty( Magnifier::Property::MAGNIFICATION_FACTOR, magnificationFactor );
  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::MAGNIFICATION_FACTOR ).Get< float >(), magnificationFactor, TEST_LOCATION );

  application.SendNotification();
  application.Render();

  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::MAGNIFICATION_FACTOR ).Get< float >(), magnificationFactor, TEST_LOCATION );

  view.SetProperty( Magnifier::Property::MAGNIFICATION_FACTOR, 1.0f );
  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::MAGNIFICATION_FACTOR ).Get< float >(), 1.0f, TEST_LOCATION );

  application.SendNotification();
  application.Render();

  DALI_TEST_EQUALS( view.GetProperty( Magnifier::Property::MAGNIFICATION_FACTOR ).Get< float >(), 1.0f, TEST_LOCATION );

  END_TEST;
}
Example #23
0
int UtcDaliStageRemoveN3(void)
{
  TestApplication application;

  Stage stage = Stage::GetCurrent();

  // Initially we have a default layer
  DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );

  // Check we cannot remove the root layer from the stage.
  Layer layer = stage.GetRootLayer();
  bool asserted = true;
  try
  {
    stage.Remove( layer );
  }
  catch( Dali::DaliException& e )
  {
    DALI_TEST_PRINT_ASSERT( e );
    DALI_TEST_ASSERT( e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION );
    asserted = true;
  }

  DALI_TEST_CHECK( asserted );
  DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
  END_TEST;
}
int UtcDaliHitTestAlgorithmOrtho02(void)
{
  TestApplication application;
  tet_infoline("Testing Dali::HitTestAlgorithm with offset Ortho camera()");

  Stage stage = Stage::GetCurrent();
  RenderTaskList renderTaskList = stage.GetRenderTaskList();
  RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
  Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();

  Vector2 stageSize ( stage.GetSize() );
  cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f,  stageSize.x * 0.7f,
                                         stageSize.y * 0.3f, -stageSize.y * 0.7f,
                                         800.0f, 4895.0f);
  cameraActor.SetPosition(0.0f, 0.0f, 1600.0f);

  Vector2 actorSize( stageSize * 0.5f );
  // Create two actors with half the size of the stage and set them to be partially overlapping
  Actor blue = Actor::New();
  blue.SetName( "Blue" );
  blue.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  blue.SetParentOrigin( Vector3(0.2f, 0.2f, 0.5f) );
  blue.SetSize( actorSize );
  blue.SetZ(30.0f);

  Actor green = Actor::New( );
  green.SetName( "Green" );
  green.SetAnchorPoint( AnchorPoint::TOP_LEFT );
  green.SetParentOrigin( Vector3(0.4f, 0.4f, 0.5f) );
  green.SetSize( actorSize );

  // Add the actors to the view
  stage.Add( blue );
  stage.Add( green );

  // Render and notify
  application.SendNotification();
  application.Render(0);
  application.Render(10);

  HitTestAlgorithm::Results results;
  HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction);
  DALI_TEST_CHECK( results.actor == green );
  DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.6f, TEST_LOCATION );

  HitTest(stage, Vector2::ZERO, results, &DefaultIsActorTouchableFunction);
  DALI_TEST_CHECK( results.actor == blue );
  DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION );

  HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction);
  DALI_TEST_CHECK( ! results.actor );
  DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION );

  // Just inside green
  HitTest(stage, stageSize*0.69f, results, &DefaultIsActorTouchableFunction);
  DALI_TEST_CHECK( results.actor == green );
  DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.98f, TEST_LOCATION );
  END_TEST;
}
Example #25
0
void testMisc() {
    State s;
    s.setNumSubsystems(1);
    s.advanceSubsystemToStage(SubsystemIndex(0), Stage::Topology);

    // Can't ask for the time before Stage::Topology, but if you could it would be NaN.
    s.advanceSystemToStage(Stage::Topology);

    // Advancing to Stage::Topology sets t=0.
    cout << "AFTER ADVANCE TO TOPOLOGY, t=" << s.getTime() << endl;

    SimTK_TEST(s.getTime()==0);

    Vector v3(3), v2(2);
    QIndex q1 = s.allocateQ(SubsystemIndex(0), v3);
    QIndex q2 = s.allocateQ(SubsystemIndex(0), v2);

    EventTriggerByStageIndex e1 = s.allocateEventTrigger(SubsystemIndex(0), Stage::Position, 3);
    EventTriggerByStageIndex e2 = s.allocateEventTrigger(SubsystemIndex(0), Stage::Instance, 2);

    printf("q1,2=%d,%d\n", (int)q1, (int)q2);
    printf("e1,2=%d,%d\n", (int)e1, (int)e2);

    //cout << s;

    DiscreteVariableIndex dv = s.allocateDiscreteVariable(SubsystemIndex(0), Stage::Dynamics, new Value<int>(5));

    s.advanceSubsystemToStage(SubsystemIndex(0), Stage::Model);
        //long dv2 = s.allocateDiscreteVariable(SubsystemIndex(0), Stage::Position, new Value<int>(5));

    Value<int>::updDowncast(s.updDiscreteVariable(SubsystemIndex(0), dv)) = 71;
    cout << s.getDiscreteVariable(SubsystemIndex(0), dv) << endl;


    s.advanceSystemToStage(Stage::Model);

    cout << "AFTER ADVANCE TO MODEL, t=" << s.getTime() << endl;

    // Event triggers are available at Instance stage.
    s.advanceSubsystemToStage(SubsystemIndex(0), Stage::Instance);
    s.advanceSystemToStage(Stage::Instance);

    printf("ntriggers=%d, by stage:\n", s.getNEventTriggers());
    for (int j=0; j<Stage::NValid; ++j) {
        Stage g = Stage(j);
        cout << g.getName() << ": " << s.getNEventTriggersByStage(g) << endl;
    }

    printf("subsys 0 by stage:\n");
    for (int j=0; j<Stage::NValid; ++j) {
        Stage g = Stage(j);
        cout << g.getName() << ": " << s.getNEventTriggersByStage(SubsystemIndex(0),g) << endl;
    }
    //cout << "State s=" << s;

    s.clear();
    //cout << "after clear(), State s=" << s;
}
Example #26
0
bool PipelineManager::pipelineStreamable() const
{
    bool streamable = false;

    Stage *s = getStage();
    if (s)
        streamable = s->pipelineStreamable();
    return streamable;
}
Example #27
0
int UtcDaliStageGetBackgroundColorP(void)
{
  TestApplication application;

  Stage stage = Stage::GetCurrent();

  DALI_TEST_EQUALS( Stage::DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION );
  END_TEST;
}
Example #28
0
QuickInfo PipelineManager::preview() const
{
    QuickInfo qi;

    validateStageOptions();
    Stage *s = getStage();
    if (s)
       qi = s->preview();
    return qi;
}
Example #29
0
Stage& PipelineManager::addWriter(const std::string& type)
{
    Stage *writer = m_factory->createStage(type);
    if (!writer)
        throw stageError("writer", type);
    writer->setLog(m_log);
    writer->setProgressFd(m_progressFd);
    m_stages.push_back(writer);
    return *writer;
}
Example #30
0
void PipelineManager::executeStream(StreamPointTable& table)
{
    validateStageOptions();
    Stage *s = getStage();
    if (!s)
        return;

    s->prepare(table);
    s->execute(table);
}