Changeset 3580

Show
Ignore:
Timestamp:
07/29/10 14:07:59 (6 weeks ago)
Author:
JO94
Message:

fixed numeric filtering for personal geodatabases

Location:
FalconView/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • FalconView/trunk/Test/GeodataDataSourcesTests/GeodataDataSourcesConsoleTester/GeodataDataSourcesConsoleTester.cpp

    r3565 r3580  
    8383 
    8484      WalkGeometry(feature->Geometry); 
     85   } 
     86} 
     87 
     88void WalkDataSet(IFvDataSet* dataSet) 
     89{ 
     90   _bstr_t name = dataSet->Name; 
     91   _bstr_t description = dataSet->Description; 
     92 
     93   // test getting and setting visibility 
     94   IUIStatePtr uiState = dataSet; 
     95   bool visible = uiState->Visible ? true : false; 
     96   uiState->Visible = true; 
     97   ASSERT(uiState->Visible); 
     98   uiState->Visible = false; 
     99   ASSERT(!uiState->Visible); 
     100   uiState->Visible = visible; 
     101   ASSERT((uiState->Visible ? true : false) == visible); 
     102 
     103   // if this is a feature data set, walk it 
     104 
     105   IFeatureDataSetPtr featureDataSet = dataSet; 
     106   if (featureDataSet) 
     107      WalkFeatureDataSet(featureDataSet); 
     108 
     109   ILibkmlScreenOverlayPtr screenOverlay = dataSet; 
     110   if (screenOverlay) 
     111   { 
     112      double d = screenOverlay->OverlayX; 
     113      ScreenOverlayUnits units = screenOverlay->OverlayXUnits; 
     114      d = screenOverlay->OverlayY; 
     115      units = screenOverlay->OverlayYUnits; 
     116      //d = screenOverlay->Rotation; 
     117      //d = screenOverlay->RotationX; 
     118      //units = screenOverlay->RotationXUnits; 
     119      //d = screenOverlay->RotationY; 
     120      //units = screenOverlay->RotationYUnits; 
     121      screenOverlay->ScreenX; 
     122      units = screenOverlay->ScreenXUnits; 
     123      d = screenOverlay->ScreenY; 
     124      units = screenOverlay->ScreenYUnits; 
     125      d = screenOverlay->SizeX; 
     126      units = screenOverlay->SizeXUnits; 
     127      d = screenOverlay->SizeY; 
     128      units = screenOverlay->SizeYUnits; 
    85129   } 
    86130} 
     
    117161   { 
    118162      IFvDataSetPtr dataSet = dataSource->GetDataSet(i); 
    119  
    120       name = dataSet->Name; 
    121       description = dataSet->Description; 
    122  
    123       // test getting and setting visibility 
    124       uiState = dataSet; 
    125       bool visible = uiState->Visible ? true : false; 
    126       uiState->Visible = true; 
    127       ASSERT(uiState->Visible); 
    128       uiState->Visible = false; 
    129       ASSERT(!uiState->Visible); 
    130       uiState->Visible = visible; 
    131       ASSERT((uiState->Visible ? true : false) == visible); 
    132  
    133       // if this is a feature data set, walk it 
    134  
    135       IFeatureDataSetPtr featureDataSet = dataSet; 
    136       if (featureDataSet) 
    137          WalkFeatureDataSet(featureDataSet); 
    138  
    139       ILibkmlScreenOverlayPtr screenOverlay = dataSet; 
    140       if (screenOverlay) 
    141       { 
    142          double d = screenOverlay->OverlayX; 
    143          ScreenOverlayUnits units = screenOverlay->OverlayXUnits; 
    144          d = screenOverlay->OverlayY; 
    145          units = screenOverlay->OverlayYUnits; 
    146          //d = screenOverlay->Rotation; 
    147          //d = screenOverlay->RotationX; 
    148          //units = screenOverlay->RotationXUnits; 
    149          //d = screenOverlay->RotationY; 
    150          //units = screenOverlay->RotationYUnits; 
    151          screenOverlay->ScreenX; 
    152          units = screenOverlay->ScreenXUnits; 
    153          d = screenOverlay->ScreenY; 
    154          units = screenOverlay->ScreenYUnits; 
    155          d = screenOverlay->SizeX; 
    156          units = screenOverlay->SizeXUnits; 
    157          d = screenOverlay->SizeY; 
    158          units = screenOverlay->SizeYUnits; 
    159       } 
     163      WalkDataSet(dataSet); 
    160164   } 
    161165 
     
    569573   WalkDataSource(dataSource); 
    570574 
    571    { // test circular filtering on points 
     575   { // test circular and attribute filtering on points 
    572576      IFeatureDataSetPtr points = dataSource->GetDataSetByName("points"); 
    573577      IFvDataSetPtr dataSet = points; 
    574578      long lFeatureCount = points->FeatureCount; 
    575       ASSERT(lFeatureCount == 6); 
    576  
    577       // the location below (-89.06, 36.43) is about 531 meters from one of the points 
     579      ASSERT(lFeatureCount == 7); 
    578580 
    579581      { // test with a rectangle created by CreateByRectangle (just to make sure it works) 
     
    598600            dataSet->Filter = NULL; 
    599601            lFeatureCount = points->FeatureCount; 
    600             ASSERT(lFeatureCount == 6); 
     602            ASSERT(lFeatureCount == 7); 
    601603         } 
    602604      } 
     
    648650      } 
    649651 
     652      { // test an attribute filter 
     653         IAttributeFilterPtr attributeFilter(CLSID_AttributeFilter); 
     654         attributeFilter->WhereClause = "Joel > 3"; 
     655         IFilterPtr filter = attributeFilter; 
     656         dataSet->Filter = filter; 
     657         lFeatureCount = points->FeatureCount; 
     658         ASSERT(lFeatureCount == 3); 
     659      } 
     660 
    650661      dataSet->Filter = NULL; // a technicality in this case 
    651662   } 
     
    655666      IFvDataSetPtr dataSet = lines; 
    656667      long lFeatureCount = lines->FeatureCount; 
    657       ASSERT(lFeatureCount == 1); 
    658  
    659       // the location below (-89.06, 36.43) is about 221 km from one of the endpoints 
     668      ASSERT(lFeatureCount == 2); 
    660669 
    661670      { // test 10 meter radius 
     
    674683         dataSet->Filter = filter; 
    675684         lFeatureCount = lines->FeatureCount; 
    676          ASSERT(lFeatureCount == 1); 
     685         ASSERT(lFeatureCount == 2); 
    677686      } 
    678687 
     
    684693      IFvDataSetPtr dataSet = polygons; 
    685694      long lFeatureCount = polygons->FeatureCount; 
    686       ASSERT(lFeatureCount == 1); 
    687  
    688       // the location below (-89.06, 36.43) is about 234 km from one of the verticies 
     695      ASSERT(lFeatureCount == 2); 
    689696 
    690697      { // test 10 meter radius 
     
    703710         dataSet->Filter = filter; 
    704711         lFeatureCount = polygons->FeatureCount; 
    705          ASSERT(lFeatureCount == 1); 
     712         ASSERT(lFeatureCount == 2); 
    706713      } 
    707714 
     
    814821   // change around the #if as necessary. 
    815822 
     823   TestPersonalGeodatabase(); 
     824 
     825#if 0 
     826 
    816827   TestKMLExport(); 
    817828 
    818 #if 1 
    819  
    820829   TestKML(); 
    821830 
     
    825834 
    826835   //WalkDAFIF(); // takes a very long time 
    827  
    828    TestPersonalGeodatabase(); 
    829836 
    830837   TestFilters(); 
  • FalconView/trunk/public/fvw_core/GeodataDataSources/FVOGRFeature.cpp

    r3489 r3580  
    8484STDMETHODIMP CFvOGRFeature::raw_GetFieldType(LONG index, FeatureFieldTypes* type) 
    8585{ 
    86     TRY_BLOCK 
    87     { 
    88         OGRFieldDefn def = m_OGR_feature->GetFieldDefnRef(index); 
     86   TRY_BLOCK 
     87   { 
     88      OGRFieldDefn def = m_OGR_feature->GetFieldDefnRef(index); 
    8989      OGRFieldType t = def.GetType(); 
    90         switch(t) 
    91         { 
    92         case OFTInteger: 
    93             *type = FIELD_TYPE_LONG; 
    94             break; 
    95         case OFTReal: 
    96             *type = FIELD_TYPE_DOUBLE; 
    97             break; 
     90 
     91      switch(t) 
     92      { 
     93      case OFTInteger: 
     94         *type = FIELD_TYPE_LONG; 
     95         break; 
     96      case OFTReal: 
     97         *type = FIELD_TYPE_DOUBLE; 
     98         break; 
     99      case OFTString: 
     100      case OFTDate: 
     101      case OFTTime: 
     102      case OFTDateTime: 
    98103      default: 
    99         //case OFTString: 
    100         //case OFTDate: 
    101         //case OFTTime: 
    102         //case OFTDateTime: 
    103             *type = FIELD_TYPE_STRING; 
    104         } 
    105     } 
    106     CATCH_BLOCK_RET 
     104         *type = FIELD_TYPE_STRING; 
     105      } 
     106   } 
     107   CATCH_BLOCK_RET 
    107108 
    108         return S_OK; 
     109   return S_OK; 
    109110} 
    110111 
    111112STDMETHODIMP CFvOGRFeature::raw_GetFieldValue(LONG index, VARIANT* value) 
    112113{ 
    113     TRY_BLOCK 
    114     { 
    115         OGRFieldDefn def = m_OGR_feature->GetFieldDefnRef(index); 
     114   TRY_BLOCK 
     115   { 
     116      OGRFieldDefn def = m_OGR_feature->GetFieldDefnRef(index); 
    116117      OGRFieldType t = def.GetType(); 
    117         switch(t) 
    118         { 
    119         case OFTInteger: 
    120             value->lVal = m_OGR_feature->GetFieldAsInteger(index); 
    121             value->vt = VT_I4; 
    122             break; 
    123         case OFTReal: 
    124             value->dblVal = m_OGR_feature->GetFieldAsDouble(index); 
    125             value->vt = VT_R8; 
    126             break; 
     118 
     119      switch(t) 
     120      { 
     121      case OFTInteger: 
     122         value->lVal = m_OGR_feature->GetFieldAsInteger(index); 
     123         value->vt = VT_I4; 
     124         break; 
     125      case OFTReal: 
     126         value->dblVal = m_OGR_feature->GetFieldAsDouble(index); 
     127         value->vt = VT_R8; 
     128         break; 
     129      case OFTString: 
     130      case OFTDate: 
     131      case OFTTime: 
     132      case OFTDateTime: 
    127133      default: 
    128         //case OFTString: 
    129         //case OFTDate: 
    130         //case OFTTime: 
    131         //case OFTDateTime: 
    132             value->bstrVal = _bstr_t(m_OGR_feature->GetFieldAsString(index)).Detach(); 
    133             value->vt = VT_BSTR; 
    134         } 
     134         value->bstrVal = _bstr_t(m_OGR_feature->GetFieldAsString(index)).Detach(); 
     135         value->vt = VT_BSTR; 
     136      } 
     137   } 
     138   CATCH_BLOCK_RET 
    135139 
    136     } 
    137     CATCH_BLOCK_RET 
    138  
    139         return S_OK; 
     140   return S_OK; 
    140141} 
    141142 
    142143STDMETHODIMP CFvOGRFeature::raw_GetFieldByName(BSTR FieldName, VARIANT* value) 
    143144{ 
    144     TRY_BLOCK 
    145     { 
    146         _bstr_t field_name(FieldName); 
    147         int index = m_OGR_feature->GetFieldIndex(field_name); 
    148         return raw_GetFieldValue((long)index, value); 
    149     } 
    150     CATCH_BLOCK_RET 
     145   TRY_BLOCK 
     146   { 
     147      _bstr_t field_name(FieldName); 
     148      int index = m_OGR_feature->GetFieldIndex(field_name); 
     149      return raw_GetFieldValue((long)index, value); 
     150   } 
     151   CATCH_BLOCK_RET 
    151152 
    152     return E_FAIL; 
     153   return E_FAIL; 
    153154} 
    154155 
  • FalconView/trunk/public/fvw_core/SLDLibrary/StyleRules.cs

    r3192 r3580  
    23022302            { 
    23032303               LoggingUtils.Assert(BCOT.expression.Length == 2, "binary operations length should be two"); 
    2304                ret = ReadExpression(BCOT.expression[0]) + opString + "'" + ReadExpression(BCOT.expression[1]) + "'"; 
     2304 
     2305               // add single quotes for non-numbers 
     2306               string sLiteral = ReadExpression(BCOT.expression[1]); 
     2307               long l; 
     2308               double d; 
     2309               bool bNumeric = long.TryParse(sLiteral, out l); 
     2310               if (!bNumeric) bNumeric = double.TryParse(sLiteral, out d); 
     2311               if (!bNumeric) sLiteral = "'" + sLiteral + "'"; 
     2312 
     2313               ret = ReadExpression(BCOT.expression[0]) + opString + sLiteral; 
    23052314            } 
    23062315            else