Skip to content

Commit dcc484d

Browse files
authored
Boolean型のAttribute対応 (Synesthesias#152)
* add getter and setter for boolean value of attribute * add c# test code * Update submodule
1 parent 016e4af commit dcc484d

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

data/日本語パステスト/udx/bldg/53392642_bldg_6697_op2.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@
535535
<uro:districtsAndZonesType codeSpace="../../codelists/Common_districtsAndZonesType.xml">11</uro:districtsAndZonesType>
536536
<uro:prefecture codeSpace="../../codelists/Common_prefecture.xml">13</uro:prefecture>
537537
<uro:city codeSpace="../../codelists/Common_localPublicAuthorities.xml">13111</uro:city>
538+
<energy:isHeated>true</energy:isHeated>
538539
</uro:BuildingDetails>
539540
</uro:buildingDetails>
540541
<uro:extendedAttribute>

wrappers/csharp/LibPLATEAU.NET/CSharpPLATEAU.Test/CityGML/AttributeValueTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,17 @@ public void AsInt_Returns_GML_Value()
7777
int actualVal = attrMap[key].AsInt;
7878
Assert.AreEqual(valueInGmlFile, actualVal);
7979
}
80+
81+
[TestMethod]
82+
public void AsBool_Returns_GML_Value()
83+
{
84+
const string parentKey = "uro:buildingDetails";
85+
const string childKey = "energy:isHeated";
86+
const bool valueInGmlFile = true;
87+
var parentVal = attrMap[parentKey];
88+
var children = parentVal.AsAttrSet;
89+
bool actualVal = children[childKey].AsBool;
90+
Assert.AreEqual(valueInGmlFile, actualVal);
91+
}
8092
}
8193
}

wrappers/csharp/LibPLATEAU.NET/CSharpPLATEAU/CityGML/AttributeValue.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public AttributeValue(IntPtr handle)
4646
/// <summary> 属性値を int にパースして返します。 </summary>
4747
public int AsInt => int.Parse(AsString);
4848

49+
/// <summary> 属性値を bool にパースして返します。 </summary>
50+
public bool AsBool => bool.Parse(AsString);
51+
4952
/// <summary>
5053
/// 属性の値の想定形式です。<see cref="AttributeType"/> 型で返します。
5154
/// </summary>

0 commit comments

Comments
 (0)