예제 #1
0
void XYGridControl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
    int nIndex = m_cellActive.m_nRow - 1;

    // Change values in Grid
    CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
    double val;
    switch (m_cellActive.m_nCol) {
    case 1: // X
        if (!IsValidReal(szText, val))
        {
            val = nullReal;
        }
        if (nIndex < xyData.Size())
        {
            xyData[nIndex].x = val;
        }
        else
        {
            xyData.SetAtGrow(nIndex, XYItem(val, 0.0));
        }
        break;
    case 2: // Y
        if (!IsValidReal(szText, val))
        {
            val = nullReal;
        }
        if (nIndex < xyData.Size())
        {
            xyData[nIndex].y = val;
        }
        else
        {
            xyData.SetAtGrow(nIndex, XYItem(0.0, val));
        }
        break;
    }

    ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

    StopEdit(false);

    // if the right key continue editing on next cell
    switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
    }
}
예제 #2
0
    void ColorMapGridControl::FinishEdit(const char* szText, int nValue, int nLastChar)
    {
        int rowIndex = m_cellActive.m_nRow - 1;
        int colIndex = m_cellActive.m_nCol - 1;

        double val;
        if ((!IsValidReal(szText, val)) || (val < 0.0) || (val > 1.0))
            val = 0.0;

        SC_ColorSpec& currSpec = gColorMap.colorMapColors[rowIndex];

        switch (colIndex )
            {
            case 0 : {currSpec.RH = val; break;}
            case 1 : {currSpec.GS = val; break;}
            case 2 : {currSpec.BV = val; break;}
            case 3 : {break;}
            }

        if (rowIndex >= gColorMap.ncolorMap)
            {
                for (int i = gColorMap.ncolorMap; i < rowIndex; i++)
                    gColorMap.colorMapColors[i] = SC_ColorSpec(0.0, 0.0, 0.0);
                m_nCurrRow = gColorMap.ncolorMap - 1;
                gColorMap.ncolorMap = rowIndex + 1;
                UpdateModifiedRows();
            }
        else
            {
                for (int j = 1; j < GetColCount(); j++)
                    {
                        CGridCell* pCell = GetCell(rowIndex + 1, j);
                        pCell->UpdateText();
                        InvalidateCell(rowIndex + 1, j);
                    }
            }

        ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

        StopEdit(false);

        // if the right key continue editing on next cell
        switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
        }
    }
예제 #3
0
/********************************************************************

  Declaration:  Default constructor. 
  Call: DynBuff()
  Input: nothing
  Returns: nothing
  08.05.2008 Initial coding YS.

*********************************************************************/
DynBuff::DynBuff():
  m_ArraySize(300),
  m_CellCntr(0),
  m_Tail(0),
  m_Head(0),
  m_MsgExistFlag(0),
  m_nOverflowFlag(0)
{
 
 MsgSent = new VCMsgSent[m_ArraySize];
 
 for (m_IntCtr=0; m_IntCtr < m_ArraySize; m_IntCtr++)
     ResetCell(m_IntCtr);  
}
예제 #4
0
/********************************************************************

  Declaration: Constructor with one parameter - buffer size.
  Call: DynBuff()
  Input: nothing
  Returns: nothing
  08.05.2008 Initial coding YS.

*********************************************************************/
DynBuff::DynBuff(int buffer_size ):
  m_ArraySize(buffer_size),
  m_CellCntr(0),
  m_Tail(0),
  m_Head(0),
  m_MsgExistFlag(0),
  m_nOverflowFlag(0)
{
 //printf ("Constructor. buffer_size  = %d\n", buffer_size );
  MsgSent = new VCMsgSent[m_ArraySize];
  
  for (m_IntCtr=0; m_IntCtr < m_ArraySize; m_IntCtr++)
     ResetCell(m_IntCtr); 

}
예제 #5
0
/********************************************************************

  Declaration: Function 
  Call: getMsgFromStore()
  Input: nothing
  Returns: nothing
  08.05.2008 Initial coding

*********************************************************************/
int DynBuff::getMsgFromStore(int *nRetParam, int *nRetMsgId)
{ 
 int nRetVal = 0;
 
  //PrintDump();
 
 if ( !m_CellCntr )
   return -1;
  
  *nRetParam = MsgSent[m_Head].Param;
  *nRetMsgId = MsgSent[m_Head].MsgId;
  
  // t.itrace("DynBuffer: get message %d from cell %d.  Time: %d\n", *nRetMsgId, m_Head, Get1msTimeMS()); 
  
  ResetCell(m_Head);
  
  m_Head++;
  if ( m_Head >= m_ArraySize )
    m_Head = 0;
        
 return nRetVal;
} 
예제 #6
0
void DataCaptureGridCtrl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
  dataCaptureUIChange = true;

  int dCapIndex = m_cellActive.m_nRow - 1;

  bool wasInvalid  = (dataCaptureData.IsNotValid(dCapIndex));

  dataCapture.CheckAndAllocDataCapture(dCapIndex);
  DataCaptureSpec& currRef = dataCaptureData.GetRef(dCapIndex);

  // Change values in Grid
  CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

  int currCol = m_cellActive.m_nCol;
  if ((!control.IsLayered()) && (currCol > 3))
    currCol++;

  if (control.Is2DRadial() && (currCol == 6))
    currCol = 7;

  switch (currCol) {
  case 1: // desig
  {
    if (!SameString(currRef.dataDesig, szText))
      currRef.makeDefaultDataDesig = false;

    CopyString(currRef.dataDesig, szText, DataCaptureSpec::dataDesigLen);

    if ((dCapIndex == 0) && (currRef.IsWell() && currRef.IsPressure()))
    {
      // changing main well name -- change for flow too
      if (dataCaptureData.IsValid(1))
      {
        DataCaptureSpec& flowRef = dataCaptureData.GetRef(1);
        if (flowRef.IsFlow() && flowRef.IsWell())
        {
          CopyString(flowRef.dataDesig, szText, DataCaptureSpec::dataDesigLen);
          ResetCell(2, 1);
        }
      }
    }
    // adding new -- assume obs well
    if (wasInvalid)
    {
      currRef.captureType = DataCaptureSpec::ctPressure;
      currRef.pressureCapType = DataCaptureSpec::pctRadius;
    }
    break;
  }
  case 2: // Type
  {
    static_cast<CaptureTypeGridCell*>(pCell)->SetDataCaptureType(nValue);
    break;

  }
  case 3: // sub-type
  {
    static_cast<CaptureSubTypeGridCell*>(pCell)->SetDataCaptureSubType(nValue);
    break;
  }
  case 4: // zone
  {
    static_cast<DcapWellboreZoneDesigGridCell*>(pCell)->SetWellboreZone(nValue);
    break;
  }
  case 5: // radii
  {
    if (currRef.UsesRadius())
    {
      if (currRef.IsPressure() && (control.Is2DRadial() || control.IsHorizontalAnisotropic()))
        ResetCell(m_cellActive.m_nRow, 5);
      else
        currRef.radiusData.IsWithinRange(szText, 0.001, 1.0E+05);
    }
    break;
  }
  case 6: // radii units
  {
    if (currRef.UsesRadiusUnits())
    {
      currRef.radiusData.SetConvIndex(nValue);
      if (currRef.UsesRadius())
        ResetCell(m_cellActive.m_nRow, 4);
    }
    break;
  }
  case 7: // output units
  {
    currRef.outputUnits.SetConvIndex(nValue);
    break;
  }

  }

  // update all
  for (int i = 1; i < GetColCount(); i++)
    ResetCell(m_cellActive.m_nRow, i);

  OutputUnitsGridCell* currCell = static_cast<OutputUnitsGridCell*>(GetCell(m_cellActive.m_nRow, GetColCount() - 1));
  currCell->SetUnitType(currRef.outputUnits.unitType);

  if (dataCapture.SetDataCaptureDesigs())
  {
    for (int i = m_cellActive.m_nRow; i < GetRowCount(); i++)
      ResetCell(i, 1);
  }

  StopEdit(false);

  // if the right key continue editing on next cell
  switch (nLastChar) {
  case VK_TAB:
  case VK_DOWN:
  case VK_UP:
  case VK_RIGHT:
  case VK_LEFT:
  case VK_NEXT:
  case VK_PRIOR:
  case VK_HOME:
  case VK_END:
    OnKeyDown(nLastChar, 0, 0);
    UpdateWindow();
    if (m_cellActive != m_cellActiveOld)
      StartEdit(nLastChar);
    break;
  }
}
예제 #7
0
void DataCaptureGridCtrl::ResetDataCaptureGrid()
{
  // start with a clean slate
  dataCapture.DataCaptureCleanup();

  // set type strings
  captureTypeStrings.Alloc(5);

  // always valid
  captureTypeStrings += "Pressure";
  captureTypeStrings += "Flow";
  captureTypeStrings += "Production";
  if (!control.IsGas())
    captureTypeStrings += "Test Zone";
  if (control.IsUnconfined())
    captureTypeStrings += "Water Table";

  pressureCapTypeStrings.Alloc(3);
  pressureCapTypeStrings += "Test Zone";
  pressureCapTypeStrings += "Observation Well";
  pressureCapTypeStrings += "Superposition";

  flowCapTypeStrings.Alloc(4);
  flowCapTypeStrings += "Well";
  flowCapTypeStrings += "Formation";
  flowCapTypeStrings += "Test Zone";
  flowCapTypeStrings += "Wellbore Storage";

  productionCapTypeStrings.Alloc(4);
  productionCapTypeStrings += "Well";
  productionCapTypeStrings += "Formation";
  productionCapTypeStrings += "Test Zone";
  productionCapTypeStrings += "Wellbore Storage";

  testZoneCapTypeStrings.Alloc(3);
  testZoneCapTypeStrings += "TZ Temp.";
  testZoneCapTypeStrings += "TZ Comp.";
  testZoneCapTypeStrings += "TZ Volume";

  waterTableCapTypeStrings.Alloc(1);
  waterTableCapTypeStrings += "Observation Well";

  int maxCol = 6;
  if (control.IsLayered())
  {
    maxCol++;
    wellboreZoneStrings.Alloc(layerSpec.GetNWellboreZone());
    for (int i = 0; i < wellBoreZones.Size(); i++)
    {
      const WellBoreZone& currZone = wellBoreZones[i];
      if (!currZone.zoneIsPacker)
        wellboreZoneStrings += currZone.intervalID;
    }
  }

  if (control.Is1DRadial())
    maxCol++;

  // make sure there are 20 blanks
  dataCaptureData.ReAlloc(dataCaptureData.Size() + 20);
  SetRowCount(dataCaptureData.AllocSize() + 1);
  SetColCount(maxCol);

  SetCenteredText(0, 1, "Well ID" );
  SetCenteredText(0, 2, "Output Type" );
  SetCenteredText(0, 3, "Sub-Type" );
  int nextCol = 4;
  if (control.IsLayered())
    SetCenteredText(0, nextCol++, "Wellbore Zone" );

  SetCenteredText(0, nextCol++, "Radius" );
  if (control.Is1DRadial())
    SetCenteredText(0, nextCol++, "RadiusUnits" );
  SetCenteredText(0, nextCol++, "Output Units" );

  CString sRowHeader;
  for (int i = 0; i < dataCaptureData.AllocSize(); i++) {

    int row = i + 1;
    sRowHeader.Format("%d", row);
    SetCenteredText(row, 0, sRowHeader );

    SetCell(row, 1, new DcapDesigGridCell(i));
    SetCell(row, 2, new CaptureTypeGridCell(i));
    SetCell(row, 3, new CaptureSubTypeGridCell(i));
    nextCol = 4;
    if (control.IsLayered())
      SetCell(row, nextCol++, new DcapWellboreZoneDesigGridCell(i));

    SetCell(row, nextCol++, new DataCaptureRadiusGridCell(i));

    if (control.Is1DRadial())
      SetCell(row, nextCol++, new RadUnitsGridCell(i));
    SetCell(row, nextCol++, new OutputUnitsGridCell(i));

    // reset all data
    for (int j = 1; j < maxCol; j++)
      ResetCell(i + 1, j);
  }

  SetEditMode();
  SetBorderThickness(4);
  AutoSize();
  for (int j = 1; j < maxCol; j++)
    SetColSize(j, GetColSize(j) + 15);

  InvalidateAll();
}
예제 #8
0
void TestZoneCurveGridCtrl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
    int tzcIndex = m_cellActive.m_nRow - 1;

    bool updateAll = (testZoneCurves.IsNotValid(tzcIndex));

    sequence.CheckAndAllocTestZoneCurve(tzcIndex);
    TestZoneCurve& currTZC = testZoneCurves.GetRef(tzcIndex);

    // Change values in Grid
    CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
    switch (m_cellActive.m_nCol) {
    case 1: // Type
        {
            static_cast<CurveTypeGridCell*>(pCell)->SetTestZoneCurveType(nValue);
            break;

        }
    case 2: // ID
        {
            if (control.UseCurveFiles())
                static_cast<CurveDesigGridCell*>(pCell)->SetTestZoneCurveDesig(nValue);
            else
                static_cast<CurveFOGridCell*>(pCell)->SetTestZoneCurveFO(nValue);
            break;
        }
    case 3: // start seq
        {
            static_cast<StartSequenceDesigGridCell*>(pCell)->SetStartSequence(nValue);
            ResetCell(m_cellActive.m_nRow, 4);
            break;
        }
    case 4: // end seq
        {
            static_cast<EndSequenceDesigGridCell*>(pCell)->SetEndSequence(nValue);
            break;
        }
    case 5: // seq data or duration status
        {
        }
        break;
    }


    if (updateAll)
    {
        for (int i = 1; i < GetColCount(); i++)
            ResetCell(m_cellActive.m_nRow, i);
    }
    else
    {
        ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
        ResetCell(m_cellActive.m_nRow, 5);
    }


    StopEdit(false);

    // if the right key continue editing on next cell
    switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
    }
}
예제 #9
0
void TestZoneCurveGridCtrl::ResetTestZoneCurveGrid()
{
    // start with a clean slate
    sequence.SequenceCleanup();

    // set type strings
    curveTypeStrings.Alloc(6);
    curveTypeMap.Alloc(6);

    // always valid
    curveTypeStrings += "Pressure";
    curveTypeMap += TestZoneCurve::tzPressure;

    curveTypeStrings += "Flow";
    curveTypeMap += TestZoneCurve::tzFlowRate;

    if (testZoneTemperatureVaries && control.IsLiquid())
    {
        curveTypeStrings += "Temperature";
        curveTypeMap += TestZoneCurve::tzTemperature;
    }

    if (testZoneCompressibilityVaries && control.IsLiquid())
    {
        curveTypeStrings += "Compressibility";
        curveTypeMap += TestZoneCurve::tzCompressibility;
    }

    if (testZoneVolumeVaries)
    {
        curveTypeStrings += "Volume Change";
        curveTypeMap += TestZoneCurve::tzDeltaVolume;
        curveTypeStrings += "Volume";
        curveTypeMap += TestZoneCurve::tzAbsVolume;
    }

    // curve file desigs
    if (control.UseCurveFiles())
    {
        nsCurveFileStatics::testZoneBCCurveFile.GetIDs(curveFileDesigStrings);
    }
    else
    {
        curveFOOK = AppMenuC::GetFuncObjList(typeid(DO_Curve), curveFOStrings, curveFOData, "   ");
    }

    // and sequences
    sequence.GetSequenceIDs(sequenceDesigStrings);


    // make sure there are 20 blanks
    testZoneCurves.ReAlloc(testZoneCurves.Size() + 20);
    SetRowCount(testZoneCurves.AllocSize() + 1);
    SetColCount(6);

    SetCenteredText(0, 1, "Type" );
    if (control.UseCurveFiles())
        SetCenteredText(0, 2, "Curve ID" );
    else
        SetCenteredText(0, 2, "Curve Object" );

    SetCenteredText(0, 3, "Start Sequence" );
    SetCenteredText(0, 4, "End Sequence" );
    SetCenteredText(0, 5, "Curve Data" );

    CString sRowHeader;
    for (int i = 0; i < testZoneCurves.AllocSize(); i++) {

        int row = i + 1;
        sRowHeader.Format("%d", row);
        SetCenteredText(row, 0, sRowHeader );

        SetCell(row, 1, new CurveTypeGridCell(i));
        if (control.UseCurveFiles())
            SetCell(row, 2, new CurveDesigGridCell(i));
        else
            SetCell(row, 2, new CurveFOGridCell(i));

        SetCell(row, 3, new StartSequenceDesigGridCell(i));
        SetCell(row, 4, new EndSequenceDesigGridCell(i));
        SetCell(row, 5, new TZDataGridCell(i));

        // reset all data
        for (int j = 1; j < 6; j++)
            ResetCell(i + 1, j);
    }

    SetEditMode();
    SetBorderThickness(4);
    AutoSize();
    for (int j = 1; j < 6; j++)
        SetColSize(j, GetColSize(j) + 15);

    InvalidateAll();
}