Пример #1
0
void CRvizMarker::SetShape(std::string shape){
    std::transform(shape.begin(), shape.end(), shape.begin(), ::tolower);
    if(shape=="cube")
        SetShape(visualization_msgs::Marker::CUBE);
    if(shape=="sphere")
        SetShape(visualization_msgs::Marker::SPHERE);
    if(shape=="arrow")
        SetShape(visualization_msgs::Marker::ARROW);
    if(shape=="cylinder")
        SetShape(visualization_msgs::Marker::CYLINDER);
}
Пример #2
0
void Cursor::SetShape(CursorShape shape)
{
    if (shape < CS_NORMAL || shape >= CS_MAX_SHAPES || shape_ == shapeNames[shape])
        return;

    SetShape(shapeNames[shape]);
}
ResearchItem::ResearchItem()
:   Building(),
    m_researchType(-1),
    m_inLibrary(false),
    m_reprogrammed(100.0),
    m_end1(NULL),
    m_end2(NULL),
    m_level(1),
	m_percentResearchedSmooth(0.0f)
{
    m_type = TypeResearchItem;
    m_researchType = GlobalResearch::TypeEngineer;
    
    SetShape( g_app->m_resource->GetShape( "researchitem.shp" ) );    

    m_front.RotateAroundY( frand(2.0 * M_PI) );

    const char end1Name[] = "MarkerGrab1";
    m_end1 = m_shape->m_rootFragment->LookupMarker( end1Name );
    AppReleaseAssert( m_end1, "ResearchItem: Can't get Marker(%s) from shape(%s), probably a corrupted file\n", end1Name, m_shape->m_name );

    const char end2Name[] = "MarkerGrab2";
    m_end2 = m_shape->m_rootFragment->LookupMarker( end2Name );
    AppReleaseAssert( m_end2, "ResearchItem: Can't get Marker(%s) from shape(%s), probably a corrupted file\n", end2Name, m_shape->m_name );
}
Пример #4
0
func Initialize()
{
	// Bin ich der erste?
	if(!FindObject(GetID()))
	{
		SetAction("Master");
		SetPosition(16,16);
		aTools = [0,0,0,0,0,0];
		for(var i = 0; i < 9; i++)
		{
			aTools[i] = CreateObject(GetID(), 26+35*i, 26, -1);
			aTools[i]->SetAction("Tool");
			aTools[i]->SetDir(0);
			aTools[i]->SetPhase(i);
			aTools[i]->LocalN("pMaster") = this;
			aTools[i]->LocalN("iToolID") = i;
		}
		aTools[0]->SetDir(1);
		iMode = -1;
		SetShape();
		if(GetPlayerCount(C4PT_User))
		{
			var iPlr = GetPlayerByIndex(0, C4PT_User);
			SetOwner(iPlr);
			MakeCrewMember(this, iPlr);
			SetFoW(0, iPlr);
			SetCursor(iPlr, this);
		}
	}
Пример #5
0
void gcImageControl::setImage(const char* image)
{
	wxRegion r;
	SetShape(r, this);
	m_imgHandle = GetGCThemeManager()->getImageHandle(image);
	invalidatePaint();
}
/**
@brief	円を描画するサンプル。
*/
void GeometryObject2D_CircleShape()
{
	// Altseedを初期化する。
	asd::Engine::Initialize(asd::ToAString("GeometryObject2D_CircleShape").c_str(), 640, 480, asd::EngineOption());

	// 図形描画オブジェクトのインスタンスを生成する。
	auto geometryObj = std::make_shared<asd::GeometryObject2D>();

	// 図形描画オブジェクトのインスタンスをエンジンに追加する。
	asd::Engine::AddObject2D(geometryObj);

	// 円の図形クラスのインスタンスを生成する。
	auto arc = std::make_shared<asd::CircleShape>();

	// 円の外径、中心位置を指定する。
	arc->SetOuterDiameter(400);
	arc->SetPosition(asd::Vector2DF(320, 240));

	// 円を描画する図形として設定する。
	geometryObj->SetShape(arc);

	// Altseedのウインドウが閉じられていないか確認する。
	while (asd::Engine::DoEvents())
	{
		// Altseedを更新する。
		asd::Engine::Update();
	}

	// Altseedを終了する。
	asd::Engine::Terminate();
}
Пример #7
0
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
    wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
                 _T("Shaped windows must be created with the wxFRAME_SHAPED style."));

#if TARGET_CARBON
    // The empty region signifies that the shape should be removed from the
    // window.
    if ( region.IsEmpty() )
    {
        wxSize sz = GetClientSize();
        wxRegion rgn(0, 0, sz.x, sz.y);
        return SetShape(rgn);
    }

    // Make a copy of the region
    RgnHandle  shapeRegion = NewRgn();
    CopyRgn( (RgnHandle)region.GetWXHRGN(), shapeRegion );

    // Dispose of any shape region we may already have
    RgnHandle oldRgn = (RgnHandle)GetWRefCon( (WindowRef)MacGetWindowRef() );
    if ( oldRgn )
        DisposeRgn(oldRgn);

    // Save the region so we can use it later
    SetWRefCon((WindowRef)MacGetWindowRef(), (SInt32)shapeRegion);

    // Tell the window manager that the window has changed shape
    ReshapeCustomWindow((WindowRef)MacGetWindowRef());
    return TRUE;
#else
    return FALSE;
#endif
}
PylonStart::PylonStart()
:   PowerBuilding(),
    m_reqBuildingId(-1)
{
    m_type = TypePylonStart;
    SetShape( g_app->m_resource->GetShape( "pylon.shp" ) );
};
Пример #9
0
void JParam::InitFloat(const String& name, float defaultVal, float minVal, float maxVal, float step, const String& label, const String& group, bool readonly, float shape, std::function<String (float)> displayTextFunction)
{
  if (mType == kTypeNone) mType = kTypeFloat;
  
  mName = name;
  mLabel = label;
  mParamGroup = group;
  mValue = defaultVal;
  mMin = minVal;
  mMax = jmax(maxVal, minVal + step);
  mStep = step;
  mDefault = defaultVal;
  mIsReadOnly = readonly;
  mDisplayTextFunction = displayTextFunction;
  
  if (mIsReadOnly)
    mCanAutomate = false;
  
  for (mDisplayPrecision = 0;
       mDisplayPrecision < MAX_PARAM_DISPLAY_PRECISION && step != floor(step);
       ++mDisplayPrecision, step *= 10.0)
  {
    ;
  }
  
  SetShape(shape);
}
Пример #10
0
bool wxSkinWindow::SetShape(const wxBitmap& img)
{
	wxRegion region;
	region = wxRegion(img);
	
	return SetShape(region);
}
Пример #11
0
D_PAD::D_PAD( MODULE* parent ) :
    BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
{
    m_NumPadName          = 0;
    m_Size.x = m_Size.y   = DMils2iu( 600 ); // Default pad size 60 mils.
    m_Drill.x = m_Drill.y = DMils2iu( 300 ); // Default drill size 30 mils.
    m_Orient              = 0;               // Pad rotation in 1/10 degrees.
    m_LengthPadToDie      = 0;

    if( m_Parent  &&  m_Parent->Type() == PCB_MODULE_T )
    {
        m_Pos = GetParent()->GetPosition();
    }

    SetShape( PAD_SHAPE_CIRCLE );                   // Default pad shape is PAD_CIRCLE.
    SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );        // Default pad drill shape is a circle.
    m_Attribute           = PAD_ATTRIB_STANDARD;    // Default pad type is NORMAL (thru hole)
    m_LocalClearance      = 0;
    m_LocalSolderMaskMargin  = 0;
    m_LocalSolderPasteMargin = 0;
    m_LocalSolderPasteMarginRatio = 0.0;
    m_ZoneConnection      = PAD_ZONE_CONN_INHERITED; // Use parent setting by default
    m_ThermalWidth        = 0;                  // Use parent setting by default
    m_ThermalGap          = 0;                  // Use parent setting by default

    // Set layers mask to default for a standard thru hole pad.
    m_layerMask           = StandardMask();

    SetSubRatsnest( 0 );                       // used in ratsnest calculations

    m_boundingRadius      = -1;
}
Пример #12
0
void D_PAD::ImportSettingsFromMaster( const D_PAD& aMasterPad )
{
    SetShape( aMasterPad.GetShape() );
    SetLayerSet( aMasterPad.GetLayerSet() );
    SetAttribute( aMasterPad.GetAttribute() );

    // The pad orientation, for historical reasons is the
    // pad rotation + parent rotation.
    // So we have to manage this parent rotation
    double pad_rot = aMasterPad.GetOrientation();

    if( aMasterPad.GetParent() )
        pad_rot -= aMasterPad.GetParent()->GetOrientation();

    if( GetParent() )
        pad_rot += GetParent()->GetOrientation();

    SetOrientation( pad_rot );

    SetSize( aMasterPad.GetSize() );
    SetDelta( wxSize( 0, 0 ) );
    SetOffset( aMasterPad.GetOffset() );
    SetDrillSize( aMasterPad.GetDrillSize() );
    SetDrillShape( aMasterPad.GetDrillShape() );
    SetRoundRectRadiusRatio( aMasterPad.GetRoundRectRadiusRatio() );

    switch( aMasterPad.GetShape() )
    {
    case PAD_SHAPE_TRAPEZOID:
        SetDelta( aMasterPad.GetDelta() );
        break;

    case PAD_SHAPE_CIRCLE:
        // ensure size.y == size.x
        SetSize( wxSize( GetSize().x, GetSize().x ) );
        break;

    default:
        ;
    }

    switch( aMasterPad.GetAttribute() )
    {
    case PAD_ATTRIB_SMD:
    case PAD_ATTRIB_CONN:
        // These pads do not have hole (they are expected to be only on one
        // external copper layer)
        SetDrillSize( wxSize( 0, 0 ) );
        break;

    default:
        ;
    }

    // Add or remove custom pad shapes:
    SetPrimitives( aMasterPad.GetPrimitives() );
    SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );
    MergePrimitivesAsPolygon();
}
Пример #13
0
void DispLoading::onEraseBG( wxEraseEvent& event )
{
	wxDC *dc = event.GetDC();

	if (!m_imgHandle.getImg() || !m_imgHandle->IsOk())
	{
		dc->SetTextForeground(wxColor(0,0,0));
		dc->Clear();
		return;
	}

	int h = GetSize().GetHeight();
	int w = GetSize().GetWidth();
	int iw = m_imgHandle->GetSize().GetWidth();


	//size 7
	const int l_start = 0;
	const int l_width = 2;

	//size 6
	const int m_start = 2;
	const int m_width = 15;

	//size 7 with 1 pix gap
	const int r_start = 17;
	const int r_width = 2;


	wxBitmap   tmpBmp(w, h);
	wxMemoryDC tmpDC(tmpBmp);

	tmpDC.SetBrush(wxBrush(wxColor(255,0,255)));
	tmpDC.SetPen( wxPen(wxColor(255,0,255),1) );
	tmpDC.DrawRectangle(0,0,w,h);

	wxImage scaled = m_imgHandle->Scale(iw, h);

	if (scaled.IsOk())
	{
		wxBitmap left = wxBitmap(scaled.GetSubImage( wxRect(l_start,0,l_width,h)) );
		wxBitmap right = wxBitmap(scaled.GetSubImage( wxRect(r_start,0,r_width,h)) );
		wxBitmap center(w-(l_width+r_width),h);

		wxColor c(255,0,255);
		gcImage::tileImg(center, wxBitmap(scaled.GetSubImage( wxRect(m_start,0,m_width,h)) ), &c);

		tmpDC.DrawBitmap(left, l_start,0,true);
		tmpDC.DrawBitmap(center, m_start,0,true);
		tmpDC.DrawBitmap(right, w-r_width,0,true);
	}

	tmpDC.SelectObject(wxNullBitmap);
	dc->DrawBitmap(tmpBmp, 0,0, true);

	wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1);
	SetShape(region, this);
}
Пример #14
0
func Initialize()
{
	// smaller SolidMask and larger shape so doors can take damage more easily
	SetSolidMask(2,0,4,40,2,0);
	SetShape(-10,-20,20,40);
	// effect to reroute life loss to damage
	AddEffect("IntLife2Damage", this, 1, 0, this);
	return _inherited(...);
}
Пример #15
0
void Shape::Init()
{
    SetColor( ofColor(ofRandom(100,255),ofRandom(70,225),ofRandom(100,255)));
    SetDistance(ofRandom(50,400));
    SetShape((ShapeType)ofRandom(ST_MAXLENGTH));
    SetSpeed(ofRandom(1,5));
    SetAngle(ofRandom(360));
    SetSize(ofRandom(10,30));
}
void Bridge::SetBridgeType ( int _type )
{
    m_bridgeType = _type;
    SetShape( m_shapes[m_bridgeType] );

    const char signalName[] = "MarkerSignal";
    m_signal = m_shape->m_rootFragment->LookupMarker( signalName );
    AppReleaseAssert( m_signal, "Bridge: Can't get Marker(%s) from shape(%s), probably a corrupted file\n", signalName, m_shape->m_name );
}
Пример #17
0
func SetRight2(object host)
{
	SetGraphics("Right");
	SetAction("Right", host);
	SetShape(0,0,4,32);
	SetPosition(host->GetX()+15, host->GetY()-48);
	SetSolidMask(0,0,2,32,2,0);
	SetVertexXY(0,-27-3,1+32);
	return true;
}
Пример #18
0
func SetLeft(object host)
{
	SetGraphics("Left");
	SetAction("Left", host);
	SetShape(0,0,4,32);
	SetPosition(host->GetX()-16, host->GetY()-16);
	SetSolidMask(0,0,2,32);
	SetVertexXY(0,1,1);
	return true;
}
Пример #19
0
func SetBottom2(object host)
{
	SetGraphics("Bottom");
	SetAction("Bottom", host);
	SetShape(0,0,32,4);
	SetPosition(host->GetX()+13, host->GetY()+12);
	SetSolidMask(0,0,32,4);
	SetVertexXY(0,1-29,-27);
	return true;
}
Пример #20
0
//------------------------------------------------------------------------------
//
gosFX::Shape__Specification::Shape__Specification(
	MidLevelRenderer::MLRShape *shape
):
	Singleton__Specification(gosFX::ShapeClassID)
{
	Check_Pointer(this);
	Verify(gos_GetCurrentHeap() == Heap);
	m_shape = NULL;
	SetShape(shape);
}
Пример #21
0
func SetTop(object host)
{
	SetGraphics("Top");
	SetAction("Top", host);
	SetShape(0,0,32,4);
	SetPosition(host->GetX()-16, host->GetY()-16);
	SetSolidMask(0,0,32,4);
	SetVertexXY(0,1,1);
	return true;
}
Пример #22
0
void HandleShapeEvent(const XShapeEvent *event) {

   ClientNode *np;

   np = FindClientByWindow(event->window);
   if(np) {
      SetShape(np);
   }

}
Пример #23
0
void Critter::SetType(Type type)
{
    switch(type)
    {
    case Type::Apple:
    {
        _splatterColor = RN::Color(0.849f, 0.009f, 0.066f);

        SetModel(RN::Model::WithFile("Models/critter/apple_01.sgm"));
        SetShape(RN::bullet::SphereShape::WithRadius(0.4f));

        SetScale(RN::Vector3(0.4f));
        break;
    }

    case Type::Banana:
    {
        _splatterColor = RN::Color(1.000f, 0.851f, 0.100f);

        SetModel(RN::Model::WithFile("Models/critter/banana_01.sgm"));
        SetShape(RN::bullet::SphereShape::WithRadius(0.4f));

        SetScale(RN::Vector3(1.2f));
        break;
    }


    case Type::Cucumber:
    {
        _splatterColor = RN::Color(0.082f, 0.657f, 0.000f);

        SetModel(RN::Model::WithFile("Models/critter/cucumber_01.sgm"));
        SetShape(RN::bullet::SphereShape::WithRadius(0.4f));

        SetScale(RN::Vector3(0.3));
        break;
    }

    default:
        break;
    }
}
Пример #24
0
void wxSkinWindow::OnSize(wxSizeEvent& e)
{
	if(bmp_normal.ISOK())
	{	int h, w;
		GetSize(&h,&w);
		if(w>0 && h>0)
		{	wxBitmap temp = wxBitmap(bmp_normal.Scale(h+1, w+1));
			SetShape(temp);
		}
	}
}
Пример #25
0
bool wxSkinWindow::SetShape(const wxImage& imgorg)
{
	wxImage img = imgorg;
	wxRegion region;
	if(img.HasAlpha())
		img.ConvertAlphaToMask();

	region = wxRegion(wxBitmap(img));

	return SetShape(region);
}
Пример #26
0
//------------------------------------------------------------------------------
//
gosFX::ShapeCloud__Specification::ShapeCloud__Specification(
	MidLevelRenderer::MLRShape *shape
):
	SpinningCloud__Specification(gosFX::ShapeCloudClassID)
{
	Check_Pointer(this);
	Verify(gos_GetCurrentHeap() == Heap);
	m_totalParticleSize = m_particleClassSize = sizeof(gosFX::ShapeCloud::Particle);
	m_shape = NULL;
	SetShape(shape);
}
Пример #27
0
void RagDoll::Bone(const String& start, const float length, ShapeType type, const Vector3& size)
{
	//Node* joint = pawn_->GetNode()->GetChild(start,true);
    Node* joint = node_->GetChild(start,true);
	Vector3 nsize = size + Vector3(0.0f,length,0.0f);
	//----make the components
	RigidBody* rb = joint->CreateComponent<RigidBody>();
	CollisionShape* cs = joint->CreateComponent<CollisionShape>();
	SetShape(cs,type,size);
	boneNode_.Push(SharedPtr<Node>(joint));
	rb->SetTrigger(true);
}
Generator::Generator()
:   PowerBuilding(),
    m_throughput(0.0f),
    m_timerSync(0.0f),
    m_numThisSecond(0),
    m_enabled(false)
{
    m_type = TypeGenerator;
    SetShape( g_app->m_resource->GetShape( "generator.shp" ) );

    m_counter = m_shape->m_rootFragment->LookupMarker( "MarkerCounter" );
}
dNewtonCollisionHeightField::dNewtonCollisionHeightField(dNewtonWorld* const world, const dFloat* const elevations, int resolution, dVector scale)
	:dNewtonCollision(world, 0)
{
	char* const attibute = new char[resolution * resolution];
	memset(attibute, 0, sizeof(char) * resolution * resolution);

	dFloat scaleFactor = 1.0f / (resolution - 1);
	NewtonCollision* const shape = NewtonCreateHeightFieldCollision(
		m_myWorld->m_world, resolution, resolution, 1, 0, elevations, attibute, 1.0f, scale.m_x * scaleFactor, scale.m_z * scaleFactor, 0);

	delete[] attibute;
	SetShape(shape);
}
Пример #30
0
void GameObject::SetShape(Shape p_shapeType)
{
	glm::vec3 translation = GetTranslation();
	glm::quat orientation = GetOrientation();
	glm::vec3 scale = GetScale();

	//TODO: if not in dynamics world
		Physics::dynamicsWorld->removeRigidBody(rigidbody);
		delete rigidbody;
	
	SetShape(translation, orientation, scale,
		p_shapeType);
}