void read_meta_data(TDimFormatHandle *fmtParams, meta_data* md)
{
  TDimTagList *tagList = &fmtParams->metaData;
  int pos;

  if (tagList == NULL) return;
  if (tagList->count == 0) return;
  if (tagList->tags == NULL) return;  
  
  //FILE *in_stream = fopen("tag270.txt", "wb");
  //fwrite(tagList->tags[pos].tagData, tagList->tags[pos].tagLength, 1, in_stream);
  //fclose(in_stream);


  //----------------------------------------------------------------------
  // STK
  //----------------------------------------------------------------------
  if (isTagPresent( tagList, 33628 ) == TRUE)
  {
    int n = 1;

    // read tag 306 - Date/Time
    if ((pos = tagPos(tagList, 306)) != -1)
    {
      md->imaging_time = new char [tagList->tags[pos].tagLength+1];
      strncpy(md->imaging_time, (char *) tagList->tags[pos].tagData, tagList->tags[pos].tagLength);
      md->imaging_time[tagList->tags[pos].tagLength] = 0;
    }

    // read tag 270 - image description
    if ((pos = tagPos(tagList, 33628)) != -1)
    {
      //md->imaging_time = new char [tagList->tags[pos].tagLength+1];
      //strncpy(md->imaging_time, (char *) tagList->tags[pos].tagData, tagList->tags[pos].tagLength);

      //FILE *in_stream = fopen("meta.txt", "wb");
      //fwrite(tagList->tags[pos].tagData, tagList->tags[pos].tagLength, 1, in_stream);
      //fclose(in_stream);
      //parse_stk_uic1 ( (unsigned char *) tagList->tags[pos].tagData, tagList->tags[pos].tagLength, 1, md);

      md->pixel_size_x = 0;
      md->pixel_size_y = 0;
    }    

    return;
  }

  //----------------------------------------------------------------------
  // PSIA
  //----------------------------------------------------------------------
  if (isTagPresent( tagList, 50432 ) == TRUE)
  {
    if ((pos = tagPos(tagList, 50435)) != -1)
    {
      psiaImageHeader *psia_head = (psiaImageHeader *) tagList->tags[pos].tagData;

      md->pixel_size_x = psia_head->dfXScanSize;
      md->pixel_size_y = psia_head->dfYScanSize;
    }

    return;
  }

  //----------------------------------------------------------------------
  // Fluoview
  //----------------------------------------------------------------------
  if (isTagPresent( tagList, 34361 ) == TRUE)
  {
    if ((pos = tagPos(tagList, 270)) != -1)
      parse_fluoview_270 ( (char *) tagList->tags[pos].tagData, md );

    if ((pos = tagPos(tagList, 285)) != -1)
      parse_fluoview_285 ( (char *) tagList->tags[pos].tagData, md );

    return;
  }

  // regular tiff
  // read tag 306 - Date/Time
  if ((pos = tagPos(tagList, 306)) != -1)
  {
    md->imaging_time = new char [tagList->tags[pos].tagLength+1];
    strncpy(md->imaging_time, (char *) tagList->tags[pos].tagData, tagList->tags[pos].tagLength);
    md->imaging_time[tagList->tags[pos].tagLength] = 0;
  }

  
}
示例#2
0
void CPersistantDebug::PostUpdateTags(float frameTime, SObj& obj)
{
    Vec3 baseCenterPos;
    float heightAboveBase(0.f);
    if (!GetEntityParams(obj.entityId, baseCenterPos, heightAboveBase))
        return;

    // Check if entity is outside of global distance maximum or behind camera
    CCamera &cam = GetISystem()->GetViewCamera();
    float distFromCam = (cam.GetPosition() - baseCenterPos).GetLength();
    float maxDist = m_pETMaxDisplayDistance->GetFVal();
    bool isOutOfRange(maxDist >= 0.f && distFromCam > maxDist);
    bool isBehindCamera(cam.GetViewdir().Dot(baseCenterPos - cam.GetPosition()) <= 0);

    heightAboveBase = max(obj.entityHeight, heightAboveBase); // never let stored entity height get smaller
    obj.entityHeight = heightAboveBase; // update stored position
    heightAboveBase += 0.2f; // make tags start a little above the entity

    std::vector<TListTag::iterator> toClear;
    for (TListTag::iterator iterList = obj.tags.begin(); iterList != obj.tags.end(); ++iterList)
    {
        iterList->vScreenPos.zero();

        if (iterList->params.visibleTime > 0.0f)
        {
            iterList->params.visibleTime -= frameTime;
            if (iterList->params.visibleTime < 0.0f)
            {
                // If visibleTime has hit 0, make sure any spillover gets applied to fade time
                iterList->params.fadeTime += iterList->params.visibleTime;
            }
        }
        else
        {
            iterList->params.fadeTime -= frameTime;
        }

        if (iterList->params.fadeTime < 0.0f)
        {
            toClear.push_back(iterList);
        }
        else
        {
            if (isOutOfRange || isBehindCamera ||	1==m_pETHideAll->GetIVal() ||
                    (1==m_pETHideBehaviour->GetIVal() && iterList->params.tagContext.compareNoCase("behaviour") == 0) ||
                    (1==m_pETHideReadability->GetIVal() && iterList->params.tagContext.compareNoCase("readability") == 0) ||
                    (1==m_pETHideAIDebug->GetIVal() && iterList->params.tagContext.compareNoCase("aidebug") == 0) ||
                    (1==m_pETHideFlowgraph->GetIVal() && iterList->params.tagContext.compareNoCase("flowgraph") == 0) ||
                    (1==m_pETHideScriptBind->GetIVal() && iterList->params.tagContext.compareNoCase("scriptbind") == 0))
                continue;

            // Check if entity is outside of max distance for this tag
            float tagMaxDist = iterList->params.viewDistance;
            if (tagMaxDist >= 0.f && distFromCam > tagMaxDist)
                continue;

            float distanceFix = distFromCam * 0.015f; // this constant found through trial and error
            float riseAmount(0.0f);
            if (iterList->params.staticId == "")
                riseAmount = 2.0f * distanceFix * (1 - (obj.timeRemaining / obj.totalTime));

            Vec3 tagPos(baseCenterPos.x, baseCenterPos.y, baseCenterPos.z + heightAboveBase + riseAmount);
            Vec3 screenPos(ZERO);
            gEnv->pRenderer->ProjectToScreen(tagPos.x, tagPos.y, tagPos.z, &screenPos.x, &screenPos.y, &screenPos.z);

            iterList->vScreenPos = screenPos;
        }
    }
    while (!toClear.empty())
    {
        obj.tags.erase(toClear.back());
        toClear.pop_back();
    }
}