Exemple #1
0
HRESULT CCollectionCache::Tags(long lCollection, LPCTSTR szTagName, IDispatch** ppdisp)
{
    HRESULT hr;

    // Make sure our collection is up-to-date.
    hr = EnsureAry(lCollection);
    if(hr)
    {
        goto Cleanup;
    }

    // Get a collection of the specified tags.
    hr = GetDisp(
        lCollection,
        szTagName,
        CacheType_Tag,
        (IDispatch**)ppdisp,
        FALSE); // Case sensitivity ignored for TagName
    if(hr)
    {
        goto Cleanup;
    }

Cleanup:
    RRETURN(hr);
}
Exemple #2
0
HRESULT CCollectionCache::GetElemAt(long lCollection, long* plCurrIndex, IDispatch** ppCurrNode)
{
    HRESULT hr;

    // Make sure our collection is up-to-date.
    hr = EnsureAry(lCollection);
    if(hr)
    {
        goto Cleanup;
    }

    *ppCurrNode = NULL;

    if(*plCurrIndex < 0)
    {
        *plCurrIndex = 0;
        goto Cleanup;
    }
    else if(*plCurrIndex > SizeAry(lCollection)-1)
    {
        *plCurrIndex = SizeAry(lCollection) - 1;
        goto Cleanup;
    }

    hr = GetDisp(lCollection, *plCurrIndex, ppCurrNode);

Cleanup:
    RRETURN(hr);
}
 void GetSysParameter()
  {
	  BROWINFO getpar_menu;
	  char parameter_str[]=" 1.时间查询    "
					       " 2.显示查询    "
					  " 3.关机时间查询"
					  " 4.背光时间查询"
					  " 5.密码状态查询"
					  " 6.本机站点查询";
					  
	  
	  int select;
	  getpar_menu.iStr=parameter_str;//浏览字符串
	  getpar_menu.lPtr = 0;//起始显示行
	  getpar_menu.cPtr = 0;//初始选择项
	  while(1)
	  {
		 DispStr_CE(0,1,"查询系统菜单",DISP_CENTER|DISP_NORMAL|DISP_CLRSCR);
		 getpar_menu.mInt=6;//显示总行数
		 getpar_menu.lineMax=15;//每行显示最大字符数 
		 getpar_menu.startLine=3;//起始行 
		 getpar_menu.dispLines=6;//
		 getpar_menu.sFont=0;  //0 -大字体
		 getpar_menu.numEnable=1;//是否允许键盘方向键 1-允许
		 getpar_menu.qEvent=(EXIT_KEY_F1);
		 getpar_menu.autoexit =120;
		 select=EXT_Brow_Select(&getpar_menu);
		 switch(select)
		 {
			  case 0:
				  GetTime();
				  break;
			  case 1:
				  GetDisp();
				  break;
			  case 2:
				  GetAutoSleep();
				  break;
			  case 3:
				  GetAutoEl();
				  break;
			  case 4:
				  GetPasswordStatus();
				  break;
			  case 5:
				  GetLocalSite();
				  break;
			  default:
				  return;
				  //break;
		  }
	  }
  }
Exemple #4
0
//+------------------------------------------------------------------------
//
//  Member:     Urns
//
//  Synopsis:   collection object model, this always returns a collection
//              and is named based on the urn, and searched based on urn
//
//-------------------------------------------------------------------------
HRESULT CCollectionCache::Urns(long lCollection, VARIANT var1, IDispatch** ppdisp)
{
    VARIANT* pvarName = NULL;
    HRESULT hr = E_INVALIDARG;

    if(!ppdisp)
    {
        goto Cleanup;
    }

    *ppdisp = NULL;

    pvarName = (V_VT(&var1)==(VT_BYREF|VT_VARIANT)) ? V_VARIANTREF(&var1) : &var1;

    if((V_VT(pvarName)==VT_BSTR) || V_VT(pvarName)==(VT_BYREF|VT_BSTR))
    {
        pvarName = (V_VT(pvarName)&VT_BYREF) ? V_VARIANTREF(pvarName) : pvarName;
    }
    else
    {
        hr = DISP_E_MEMBERNOTFOUND;
        goto Cleanup;
    }

    // Make sure our collection is up-to-date.
    hr = EnsureAry(lCollection);
    if(hr)
    {
        goto Cleanup;
    }

    // Get a collection of the elements with the specified urn
    hr = GetDisp(
        lCollection,
        V_BSTR(pvarName),
        CacheType_Urn,
        (IDispatch**)ppdisp,
        FALSE); // Case sensitivity ignored for Urn
    if(hr)
    {
        goto Cleanup;
    }

Cleanup:
    RRETURN(hr);
}
Exemple #5
0
double TLFRingBuffer::GetSigma()
{
	double s = GetDisp();
	return sqrt(s);
}
Exemple #6
0
Mesh*
TriObject::GetRenderMesh(TimeValue t, INode *inode, View &view, BOOL& needDelete)
{
	if (mDisableDisplacement || !(view.flags & RENDER_MESH_DISPLACEMENT_MAP)) {
		needDelete = FALSE;
		return &mesh;
	}
	// need to check the mesh and see if any face has a matId the requires displacment mapping
	BOOL needDisp = FALSE;

	// Get the material
	Mtl* pMtl = inode ? inode->GetMtl() : NULL;

	if (pMtl) {
		// does the mesh as a whole need it
		if (pMtl->Requirements(mesh.mtlIndex)&MTLREQ_DISPLACEMAP)
			needDisp = TRUE;

		if (!needDisp) {
			for (int f = 0; f < mesh.numFaces; f++) {
				if (pMtl->Requirements(mesh.getFaceMtlIndex(f))&MTLREQ_DISPLACEMAP) {
					needDisp = TRUE;
					break;
				}
			}
		}

		if (needDisp) {
            if (mesh.getNumFaces() == 0)
                return &mesh;

			Matrix3 otm;
			if (inode)
				otm = inode->GetObjectTM(t);
			else
				otm.IdentityMatrix();
			GetGTessFunction();
			if (mSubDivideDisplacement && psGTessFunc) {
				// if we have a material that does displacement mapping and if we can do it
				Mesh *pMesh = new Mesh();
				needDelete = TRUE;
				(*psGTessFunc)((void *)&mesh, MAX_MESH, &otm, pMesh, NULL,
								&mDispApprox, &view, pMtl, FALSE, mSplitMesh);
				needDelete = TRUE;
				return pMesh;
			} else {
				Mesh *pMesh = new Mesh(mesh);
				needDelete = TRUE;

                BOOL hasUVs = pMesh->tvFace != NULL;
				pMesh->buildRenderNormals();

				// now displace the verts
				BitArray vertsSet;
				vertsSet.SetSize(pMesh->numVerts);

				for (int f = 0; f < pMesh->numFaces; f++) {
					Face *pFace = &pMesh->faces[f];
					TVFace *pTVFace = &pMesh->tvFace[f];
					int matid = pFace->getMatID();
					for (int v = 0; v < 3; v++) {
						int vidx = pFace->v[v];
						if (vertsSet[vidx])
							continue; // displace only once
						Point3 norm = pMesh->getNormal(vidx);
						norm.Normalize();
						Point3& vert = pMesh->getVert(vidx);

						UVVert uvvert;
                        if (hasUVs)
                            uvvert = pMesh->getTVert(pTVFace->t[v]);
                        else {
                            uvvert.x = 0.0;
                            uvvert.y = 0.0;
                        }

						pMesh->buildBoundingBox();
						Box3 bbox = pMesh->getBoundingBox();
						float dispScale = Length(bbox.pmax - bbox.pmin)/10.0f;

						float disp = GetDisp(pMtl, pMesh, f, pFace->getMatID(), vert, uvvert.x, uvvert.y, otm) * dispScale;
						vert += (norm * disp);
						vertsSet.Set(vidx);
					}
				}
				return pMesh;
			}
		}
	}

	needDelete = FALSE;
	return &mesh;
}
Exemple #7
0
//+------------------------------------------------------------------------
//
//  Member:     GetNewEnum
//
//  Synopsis:   collection object model
//
//-------------------------------------------------------------------------
HRESULT CCollectionCache::GetNewEnum(long lCollection, IUnknown** ppEnum)
{
    CPtrAry<LPUNKNOWN>* pary = NULL;
    long                lSize;
    long                l;
    HRESULT             hr = E_INVALIDARG;

    if(!ppEnum)
    {
        goto Cleanup;
    }

    *ppEnum = NULL;

    // Make sure our collection is up-to-date.
    hr = EnsureAry(lCollection);
    if(hr)
    {
        goto Cleanup;
    }

    pary = new CPtrAry<LPUNKNOWN>;
    if(!pary)
    {
        hr = E_OUTOFMEMORY;
        goto Cleanup;
    }

    lSize = SizeAry(lCollection);

    hr = pary->EnsureSize(lSize);
    if(hr)
    {
        goto Error;
    }

    // Now make a snapshot of our collection.
    for(l=0; l<lSize; ++l)
    {
        IDispatch* pdisp;

        hr = GetDisp(lCollection, l, &pdisp);
        if(hr)
        {
            goto Error;
        }

        Verify(!pary->Append(pdisp));
    }

    // Turn the snapshot into an enumerator.
    hr = pary->EnumVARIANT(VT_DISPATCH, (IEnumVARIANT**) ppEnum, FALSE, TRUE);
    if(hr)
    {
        goto Error;
    }

Cleanup:
    RRETURN(hr);

Error:
    pary->ReleaseAll();
    goto Cleanup;
}
Exemple #8
0
//+------------------------------------------------------------------------
//
//  Member:     Item
//
//  Synopsis:   collection object model
//
//              we handle the following parameter cases:
//                  0 params            : by index = 0
//                  1 params bstr       : by name, index = 0
//                  1 params #          : by index
//                  2 params bstr, #    : by name, index
//                  2 params #, bstr    : by index, ignoring bstr
//
//-------------------------------------------------------------------------
HRESULT CCollectionCache::Item(long lCollection, VARIANTARG var1, VARIANTARG var2, IDispatch** ppResult)
{
    VARIANT*    pvarName = NULL;
    VARIANT*    pvarOne  = NULL;
    VARIANT*    pvarIndex = NULL;
    long        lIndex = 0;
    HRESULT     hr=E_INVALIDARG;

    if(!ppResult)
    {
        goto Cleanup;
    }

    *ppResult = NULL;

    pvarOne = (V_VT(&var1) == (VT_BYREF|VT_VARIANT)) ? V_VARIANTREF(&var1) : &var1;

    if((V_VT(pvarOne)==VT_BSTR) || V_VT(pvarOne)==(VT_BYREF|VT_BSTR))
    {
        pvarName = (V_VT(pvarOne)&VT_BYREF) ? V_VARIANTREF(pvarOne) : pvarOne;

        if((V_VT(&var2)!=VT_ERROR) && (V_VT(&var2)!=VT_EMPTY))
        {
            pvarIndex = &var2;
        }
    }
    else if((V_VT(&var1)!=VT_ERROR )&& (V_VT(&var1)!=VT_EMPTY))
    {
        pvarIndex = &var1;
    }

    if(pvarIndex)
    {
        VARIANT varNum;

        VariantInit(&varNum);
        hr = VariantChangeTypeSpecial(&varNum, pvarIndex, VT_I4);
        if(hr)
        {
            goto Cleanup;
        }

        lIndex = V_I4(&varNum);
    }

    // Make sure our collection is up-to-date.
    hr = EnsureAry(lCollection);
    if(hr)
    {
        goto Cleanup;
    }

    // Get a collection or element of the specified object.
    if(pvarName)
    {
        BSTR Name = V_BSTR(pvarName);

        if(pvarIndex)
        {
            hr = GetDisp(
                lCollection,
                Name,
                lIndex,
                ppResult,
                FALSE); // BUBUG rgardner - shouldn't ignore case
            if(hr)
            {
                goto Cleanup;
            }
        }
        else
        {
            hr = GetDisp(
                lCollection,
                Name,
                CacheType_Named,
                ppResult,
                FALSE); // BUBUG rgardner - shouldn't ignore case
            if(FAILED(hr))
            {
                HRESULT hrSave = hr; // save error code, and see if it a cell range
                hr = GetDisp(
                    lCollection,
                    Name,
                    CacheType_CellRange,
                    ppResult,
                    FALSE); // BUBUG rgardner - shouldn't ignore case
                if(hr)
                {
                    hr = hrSave; // restore error code
                    goto Cleanup;
                }
            }
        }
    }
    else
    {
        hr = GetDisp(lCollection, lIndex, ppResult);
        if(hr)
        {
            goto Cleanup;
        }
    }

Cleanup:
    // If we didn't find anything, make sure to just return NULL.
    if(hr == DISP_E_MEMBERNOTFOUND)
    {
        hr = S_OK;
    }

    RRETURN(hr);
}