/// <summary> Writes the formatted metadata from the provided item to a TextWriter (usually to an output stream) </summary> /// <param name="Output_Stream"></param> /// <param name="Item_To_Save"> Package with all the metadata to save </param> /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param> /// <param name="Error_Message">[OUTPUT] Explanation of the error, if an error occurs during write </param> /// <returns>TRUE if successful, otherwise FALSE </returns> /// <remarks>This writer accepts one option value. 'Coordinates_File_ReaderWriter:CSV_Style' is a boolean value which indicates /// if the Dublin Core metadata file should be written in CSV format. (Default is FALSE).</remarks> public bool Write_Metadata(System.IO.TextWriter Output_Stream, SobekCM_Item Item_To_Save, Dictionary <string, object> Options, out string Error_Message) { // Set default error output message Error_Message = String.Empty; // Determine if this is to write the GML XML, or the less often used CSV coordinate file bool csv_style = false; if (Options.ContainsKey("Coordinates_File_ReaderWriter:CSV_Style")) { bool.TryParse(Options["Coordinates_File_ReaderWriter:CSV_Style"].ToString(), out csv_style); } // Get the coordinates object GeoSpatial_Information geoInfo = Item_To_Save.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo == null) || (!geoInfo.hasData)) { Error_Message = "No coordinate information to write."; return(false); } // Call the appropriate writer if (csv_style) { return(Write_CSVFILE(Output_Stream, Item_To_Save, Options)); } else { return(Write_GMLFile(Output_Stream, Item_To_Save, Options)); } }
/// <summary> Prepares the bib object for the save, by clearing the /// existing data in this element's related field. </summary> /// <param name="Bib"> Existing Bib object </param> public override void Prepare_For_Save(SobekCM_Item Bib) { GeoSpatial_Information coordInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (coordInfo != null) { coordInfo.Clear_Points(); } }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { GeoSpatial_Information coordInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((coordInfo != null) && (base.index < coordInfo.Point_Count)) { thisLatitudeBox.Text = coordInfo.Points[base.index].Latitude.ToString(); thisLongitudeBox.Text = coordInfo.Points[base.index].Longitude.ToString(); } }
/// <summary> Prepares the bib object for the save, by clearing any existing data in this element's related field(s) </summary> /// <param name="Bib"> Existing digital resource object which may already have values for this element's data field(s) </param> /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param> /// <remarks> This clears any preexisting coordinate points </remarks> public override void Prepare_For_Save(SobekCM_Item Bib, User_Object Current_User) { // GEt the geospatial metadata module GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo != null) { geoInfo.Clear_Points(); } }
/// <summary> Flag indicates if this active reader/writer needs to append schema reference information /// to the METS XML header by analyzing the contents of the division </summary> /// <param name="MetsDivision"> Division from the overall package into which to read the metadata</param> /// <returns> TRUE if the schema should be attached, otherwise fALSE </returns> public bool Schema_Reference_Required_Division(abstract_TreeNode MetsDivision) { // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = MetsDivision.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo == null) || (!geoInfo.hasData)) { return(false); } return(true); }
/// <summary> Flag indicates if this active reader/writer will write a dmdSec </summary> /// <param name="METS_Item"> Package with all the metadata to save</param> /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param> /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns> public bool Include_dmdSec(SobekCM_Item METS_Item, Dictionary <string, object> Options) { // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo == null) || (!geoInfo.hasData)) { return(false); } return(true); }
/// <summary> Flag indicates if this active reader/writer needs to append schema reference information /// to the METS XML header by analyzing the contents of the digital resource item </summary> /// <param name="METS_Item"> Package with all the metadata to save</param> /// <returns> TRUE if the schema should be attached, otherwise fALSE </returns> public bool Schema_Reference_Required_Package(SobekCM_Item METS_Item) { // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo == null) || (!geoInfo.hasData)) { return(false); } return(true); }
/// <summary> Writes the dmdSec for one subsection/division of the METS structure map </summary> /// <param name="Output_Stream">Stream to which the formatted text is written </param> /// <param name="MetsDivision">Division from the overall package with all the metadata to save</param> /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param> /// <returns>TRUE if successful, otherwise FALSE </returns> public bool Write_dmdSec(TextWriter Output_Stream, abstract_TreeNode MetsDivision, Dictionary <string, object> Options) { // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = MetsDivision.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo == null) || (!geoInfo.hasData)) { return(true); } return(Write_Metadata_Section(Output_Stream, geoInfo, Options)); }
/// <summary> Reads the dmdSec at the current position in the XmlTextReader and associates it with /// one subsection/division from the METS structure map </summary> /// <param name="Input_XmlReader"> Open XmlReader from which to read the metadata </param> /// <param name="MetsDivision"> Division from the overall package into which to read the metadata</param> /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param> /// <returns> TRUE if successful, otherwise FALSE</returns> public bool Read_dmdSec(XmlReader Input_XmlReader, abstract_TreeNode MetsDivision, Dictionary <string, object> Options) { // Get the geo-spatial information if it exists or create a new one GeoSpatial_Information geoInfo = MetsDivision.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { geoInfo = new GeoSpatial_Information(); MetsDivision.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo); } return(Read_Metadata_Section(Input_XmlReader, geoInfo, Options)); }
/// <summary> Reads the dmdSec at the current position in the XmlTextReader and associates it with the /// entire package </summary> /// <param name="Input_XmlReader"> Open XmlReader from which to read the metadata </param> /// <param name="Return_Package"> Package into which to read the metadata</param> /// <param name="Options"> Dictionary of any options which this METS section reader may utilize</param> /// <returns> TRUE if successful, otherwise FALSE</returns> public bool Read_dmdSec(XmlReader Input_XmlReader, SobekCM_Item Return_Package, Dictionary <string, object> Options) { // Get the geo-spatial information if it exists or create a new one GeoSpatial_Information geoInfo = Return_Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { geoInfo = new GeoSpatial_Information(); Return_Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo); } return(Read_Metadata_Section(Input_XmlReader, geoInfo, Options)); }
/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { List <Coordinate_Point> points = new List <Coordinate_Point>(); string[] getKeys = HttpContext.Current.Request.Form.AllKeys; string latitude = String.Empty; foreach (string thisKey in getKeys) { if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_first") == 0) { latitude = HttpContext.Current.Request.Form[thisKey]; } if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_second") != 0) { continue; } string longitude = HttpContext.Current.Request.Form[thisKey]; if ((latitude.Length > 0) && (longitude.Length > 0)) { double latitude_double, longitude_double; if ((Double.TryParse(latitude, out latitude_double)) && (Double.TryParse(longitude, out longitude_double))) { points.Add(new Coordinate_Point(latitude_double, longitude_double)); } latitude = String.Empty; } } // GEt the geospatial metadata module if (points.Count > 0) { GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { geoInfo = new GeoSpatial_Information(); Bib.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo); } foreach (Coordinate_Point thisPoint in points) { geoInfo.Add_Point(thisPoint); } } }
/// <summary> Renders the HTML for this element </summary> /// <param name="Output"> Textwriter to write the HTML for this element </param> /// <param name="Bib"> Object to populate this element from </param> /// <param name="Skin_Code"> Code for the current skin </param> /// <param name="IsMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param> /// <param name="PopupFormBuilder"> Builder for any related popup forms for this element </param> /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param> /// <param name="CurrentLanguage"> Current user-interface language </param> /// <param name="Translator"> Language support object which handles simple translational duties </param> /// <param name="Base_URL"> Base URL for the current request </param> /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks> public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool IsMozilla, StringBuilder PopupFormBuilder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL) { // Check that an acronym exists if (Acronym.Length == 0) { const string defaultAcronym = "Enter latitude and longitude for a coordinate related to this item"; switch (CurrentLanguage) { case Web_Language_Enum.English: Acronym = defaultAcronym; break; case Web_Language_Enum.Spanish: Acronym = defaultAcronym; break; case Web_Language_Enum.French: Acronym = defaultAcronym; break; default: Acronym = defaultAcronym; break; } } List <string> latitudes = new List <string>(); List <string> longitudes = new List <string>(); // GEt the geospatial metadata module GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo != null) { if (geoInfo.hasData) { for (int i = 0; i < geoInfo.Point_Count; i++) { latitudes.Add(geoInfo.Points[i].Latitude.ToString()); longitudes.Add(geoInfo.Points[i].Longitude.ToString()); } } } render_helper(Output, latitudes, longitudes, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL); }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { // Just save this object coordObject = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (coordObject == null) { coordObject = new GeoSpatial_Information(); } if (Bib.Bib_Info.Type.MODS_Type == TypeOfResource_MODS_Enum.Cartographic) { isMap = true; } else { isMap = false; } }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object into which to save this element's data </param> public override void Save_To_Bib(SobekCM_Item Bib) { if ((thisLatitudeBox.Text.Trim().Length > 0) || (thisLongitudeBox.Text.Trim().Length > 0)) { GeoSpatial_Information coordInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (coordInfo == null) { coordInfo = new GeoSpatial_Information(); Bib.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, coordInfo); } try { coordInfo.Add_Point(Convert.ToDouble(thisLatitudeBox.Text.Trim()), Convert.ToDouble(thisLongitudeBox.Text.Trim()), String.Empty); } catch { } } }
/// <summary> Constructor for a new Coordinate_Form_Element, used in the metadata /// template to display and allow the user to edit notes about a /// bibliographic package. </summary> public Coordinate_Form_Element() : base("Coordinates") { // Set the type of this object base.type = Element_Type.Coordinates; base.display_subtype = "form"; // Set some immutable characteristics always_single = true; always_mandatory = false; base.thisBox.DoubleClick += thisBox_Click; base.thisBox.KeyDown += thisBox_KeyDown; base.thisBox.ReadOnly = true; base.thisBox.BackColor = Color.White; coordObject = new GeoSpatial_Information(); listenForChange = false; isMap = false; }
/// <summary> </summary> /// <param name="thisElement"></param> /// <param name="Bib"></param> /// <returns></returns> private int Get_Bib_Element_Count(abstract_Element thisElement, SobekCM_Item Bib) { switch (thisElement.Type) { case Element_Type.Abstract: return(Bib.Bib_Info.Abstracts_Count); case Element_Type.Affiliation: return(Bib.Bib_Info.Affiliations_Count); case Element_Type.Aggregations: return(Bib.Behaviors.Aggregation_Count > 0 ? 1 : 0); case Element_Type.Attribution: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type == Note_Type_Enum.funding)); case Element_Type.BibID: return(1); case Element_Type.Classification: return(Bib.Bib_Info.Classifications_Count); case Element_Type.Contributor: int contributor_count = 0; if ((Bib.Bib_Info.Main_Entity_Name.hasData) && (Bib.Bib_Info.Main_Entity_Name.Roles.Count > 0) && ((Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() == "CONTRIBUTOR") || (Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() == "CTB"))) { contributor_count++; } contributor_count += Bib.Bib_Info.Names.Count(thisName => (thisName.Roles.Count > 0) && ((thisName.Roles[0].Role.ToUpper() == "CONTRIBUTOR") || (thisName.Roles[0].Role.ToUpper() == "CTB"))); return(contributor_count); case Element_Type.Coordinates: GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { return(0); } return((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0) ? 1 : 0); case Element_Type.Creator: if ((thisElement.Display_SubType != "simple") || (((Creator_Simple_Element)thisElement).Contributor_Exists == false)) { return(Bib.Bib_Info.Main_Entity_Name.hasData ? Bib.Bib_Info.Names.Count + 1 : Bib.Bib_Info.Names.Count); } int non_contributor_count = 0; if ((Bib.Bib_Info.Main_Entity_Name.hasData) && ((Bib.Bib_Info.Main_Entity_Name.Roles.Count == 0) || ((Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() != "CONTRIBUTOR") && (Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() != "CTB")))) { non_contributor_count++; } non_contributor_count += Bib.Bib_Info.Names.Count(thisName => (thisName.Roles.Count == 0) || ((thisName.Roles[0].Role.ToUpper() != "CONTRIBUTOR") && (thisName.Roles[0].Role.ToUpper() != "CTB"))); return(non_contributor_count); case Element_Type.CreatorNotes: return(Bib.METS_Header.Creator_Individual_Notes_Count > 0 ? 1 : 0); case Element_Type.Date: return(Bib.Bib_Info.Origin_Info.Date_Issued.Length == 0 ? 0 : 1); case Element_Type.DateCopyrighted: return(Bib.Bib_Info.Origin_Info.Date_Copyrighted.Length > 0 ? 1 : 0); case Element_Type.DescriptionStandard: return(Bib.Bib_Info.Record.Description_Standard.Length > 0 ? 1 : 0); case Element_Type.Donor: return(Bib.Bib_Info.Donor.Full_Name.Length > 0 ? 1 : 0); case Element_Type.Edition: return(Bib.Bib_Info.Origin_Info.Edition.Length > 0 ? 1 : 0); case Element_Type.EncodingLevel: return(Bib.Bib_Info.EncodingLevel.Length > 0 ? 1 : 0); case Element_Type.EAD: return((Bib.Bib_Info.Location.EAD_URL.Length > 0) || (Bib.Bib_Info.Location.EAD_Name.Length > 0) ? 1 : 0); case Element_Type.Error: return(0); case Element_Type.ETD_CommitteeChair: Thesis_Dissertation_Info thesisInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo != null) && (thesisInfo.Committee_Chair.Length > 0) ? 1 : 0); case Element_Type.ETD_CommitteeCoChair: Thesis_Dissertation_Info thesisInfo2 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo2 != null) && (thesisInfo2.Committee_Co_Chair.Length > 0) ? 1 : 0); case Element_Type.ETD_CommitteeMember: Thesis_Dissertation_Info thesisInfo3 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo3 != null) ? thesisInfo3.Committee_Members_Count : 0); case Element_Type.ETD_Degree: Thesis_Dissertation_Info thesisInfo4 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo4 != null) && (thesisInfo4.Degree.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeDiscipline: Thesis_Dissertation_Info thesisInfo5 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo5 != null) && (thesisInfo5.Degree_Discipline.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeGrantor: Thesis_Dissertation_Info thesisInfo6 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo6 != null) && (thesisInfo6.Degree_Grantor.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeLevel: Thesis_Dissertation_Info thesisInfo7 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo7 != null) && (thesisInfo7.Degree_Level != Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Unknown) ? 1 : 0); case Element_Type.ETD_GraduationDate: Thesis_Dissertation_Info thesisInfo8 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo8 != null) && (thesisInfo8.Graduation_Date.HasValue) ? 1 : 0); case Element_Type.FCLA_Flags: return(1); case Element_Type.FDA_Account: DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo != null && daitssInfo.Account.Trim().Length > 0 ? 1 : 0); case Element_Type.FDA_SubAccount: DAITSS_Info daitssInfo2 = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo2 != null && daitssInfo2.SubAccount.Trim().Length > 0 ? 1 : 0); case Element_Type.FDA_Project: DAITSS_Info daitssInfo3 = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo3 != null && daitssInfo3.Project.Trim().Length > 0 ? 1 : 0); case Element_Type.Format: return(Bib.Bib_Info.Original_Description.Extent.Length > 0 ? 1 : 0); case Element_Type.Frequency: return(Bib.Bib_Info.Origin_Info.Frequencies_Count); case Element_Type.Genre: return(Bib.Bib_Info.Genres_Count); case Element_Type.Holding: return(1); case Element_Type.Wordmark: return(Bib.Behaviors.Wordmark_Count > 0 ? 1 : 0); case Element_Type.Identifier: return(Bib.Bib_Info.Identifiers_Count); case Element_Type.Language: return(Bib.Bib_Info.Languages.Count(thisLanguage => thisLanguage.Language_Text.Length > 0)); case Element_Type.MainThumbnail: return(Bib.Behaviors.Main_Thumbnail.Length > 0 ? 1 : 0); case Element_Type.Manufacturer: return(Bib.Bib_Info.Manufacturers_Count); case Element_Type.Note: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type != Note_Type_Enum.statement_of_responsibility)); case Element_Type.OtherURL: return((Bib.Bib_Info.Location.Other_URL.Length > 0) || (Bib.Bib_Info.Location.Other_URL_Note.Length > 0) ? 1 : 0); case Element_Type.PALMM_Code: return(1); case Element_Type.Publisher: return(Bib.Bib_Info.Publishers_Count); case Element_Type.Publication_Place: if (Bib.Bib_Info.Publishers_Count > 0) { if (Bib.Bib_Info.Publishers.SelectMany(thisName => thisName.Places).Any(thisPlace => thisPlace.Place_Text.Length > 0)) { return(1); } } return(0); case Element_Type.RecordOrigin: return(Bib.Bib_Info.Record.Record_Origin.Length > 0 ? 1 : 0); case Element_Type.RecordStatus: return(1); case Element_Type.RelatedItem: return(Bib.Bib_Info.RelatedItems_Count); case Element_Type.Rights: return(Bib.Bib_Info.Access_Condition.Text.Length > 0 ? 1 : 0); case Element_Type.Scale: if (Bib.Bib_Info.Subjects.Where(thisSubject => thisSubject.Class_Type == Subject_Info_Type.Cartographics).Any(thisSubject => ((Subject_Info_Cartographics)thisSubject).Scale.Length > 0)) { return(1); } return(0); case Element_Type.SerialHierarchy: return(Bib.Behaviors.Serial_Info.Count > 0 ? 1 : 0); case Element_Type.Source_Institution: return(1); case Element_Type.Source_Note: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type == Note_Type_Enum.source)); case Element_Type.Spatial: int hierSubjectCount = 0; if (thisElement.Display_SubType == "dublincore") { foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial) { hierSubjectCount++; } else if (thisSubject.Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = (Subject_Info_Standard)thisSubject; if ((standSubject.Genres_Count == 0) && (standSubject.Occupations_Count == 0) && (standSubject.Topics_Count == 0)) { hierSubjectCount++; } } } } else { hierSubjectCount += Bib.Bib_Info.Subjects.Count(thisSubject => thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial); } return(hierSubjectCount); case Element_Type.Structure_Map: return(1); case Element_Type.Subject: bool standard = true; if ((thisElement.Display_SubType == "simple") || (thisElement.Display_SubType == "dublincore")) { if (((Subject_Simple_Element)thisElement).Seperate_Dublin_Core_Spatial_Exists) { standard = false; } } int subjectCount = 0; if (standard) { subjectCount += Bib.Bib_Info.Subjects.Count(thisSubject => (thisSubject.Class_Type == Subject_Info_Type.Standard) || (thisSubject.Class_Type == Subject_Info_Type.TitleInfo) || (thisSubject.Class_Type == Subject_Info_Type.Name)); } else { foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { switch (thisSubject.Class_Type) { case Subject_Info_Type.TitleInfo: subjectCount++; break; case Subject_Info_Type.Name: subjectCount++; break; case Subject_Info_Type.Standard: Subject_Info_Standard standSubject = (Subject_Info_Standard)thisSubject; if ((standSubject.Topics_Count > 0) || (standSubject.Occupations_Count > 0) || (standSubject.Genres_Count > 0)) { subjectCount++; } break; } } } return(subjectCount); case Element_Type.TargetAudience: return(Bib.Bib_Info.Target_Audiences.Any(thisTarget => thisTarget.Authority != "marctarget") ? 1 : 0); case Element_Type.Temporal: return(Bib.Bib_Info.TemporalSubjects_Count); case Element_Type.Title: return(1); case Element_Type.Title_Other: int title_count = 0; if (Bib.Bib_Info.Main_Title.Subtitle.Length > 0) { title_count++; } if ((Bib.Bib_Info.hasSeriesTitle) && (Bib.Bib_Info.SeriesTitle.Title.Length > 0)) { title_count++; } if (Bib.Bib_Info.Other_Titles_Count > 0) { title_count += Bib.Bib_Info.Other_Titles.Count(thisTitle => thisTitle.Title.Length > 0); } return(title_count); case Element_Type.Type: return(1); case Element_Type.VID: return(1); case Element_Type.Viewer: return(Bib.Behaviors.Views_Count); case Element_Type.VRA_CulturalContext: VRACore_Info vraInfo = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo != null ? vraInfo.Cultural_Context_Count : 0); case Element_Type.VRA_Inscription: VRACore_Info vraInfo2 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo2 != null ? vraInfo2.Inscription_Count : 0); case Element_Type.VRA_Material: VRACore_Info vraInfo3 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo3 != null ? vraInfo3.Material_Count : 0); case Element_Type.VRA_Measurement: VRACore_Info vraInfo4 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo4 != null ? vraInfo4.Measurement_Count : 0); case Element_Type.VRA_StateEdition: VRACore_Info vraInfo5 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo5 != null ? vraInfo5.State_Edition_Count : 0); case Element_Type.VRA_StylePeriod: VRACore_Info vraInfo6 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo6 != null ? vraInfo6.Style_Period_Count : 0); case Element_Type.VRA_Technique: VRACore_Info vraInfo7 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo7 != null ? vraInfo7.Technique_Count : 0); case Element_Type.Web_Skin: return(Bib.Behaviors.Web_Skin_Count > 0 ? 1 : 0); case Element_Type.ZT_Class: Zoological_Taxonomy_Info darwinCoreInfo = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo != null && darwinCoreInfo.Class.Length > 0 ? 1 : 0); case Element_Type.ZT_CommonName: Zoological_Taxonomy_Info darwinCoreInfo2 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo2 != null && darwinCoreInfo2.Common_Name.Length > 0 ? 1 : 0); case Element_Type.ZT_Family: Zoological_Taxonomy_Info darwinCoreInfo3 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo3 != null && darwinCoreInfo3.Family.Length > 0 ? 1 : 0); case Element_Type.ZT_Genus: Zoological_Taxonomy_Info darwinCoreInfo4 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo4 != null && darwinCoreInfo4.Genus.Length > 0 ? 1 : 0); case Element_Type.ZT_HigherClassification: Zoological_Taxonomy_Info darwinCoreInfo5 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo5 != null && darwinCoreInfo5.Higher_Classification.Length > 0 ? 1 : 0); case Element_Type.ZT_Kingdom: Zoological_Taxonomy_Info darwinCoreInfo6 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo6 != null && darwinCoreInfo6.Kingdom.Length > 0 ? 1 : 0); case Element_Type.ZT_Order: Zoological_Taxonomy_Info darwinCoreInfo7 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo7 != null && darwinCoreInfo7.Order.Length > 0 ? 1 : 0); case Element_Type.ZT_Phylum: Zoological_Taxonomy_Info darwinCoreInfo8 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo8 != null && darwinCoreInfo8.Phylum.Length > 0 ? 1 : 0); case Element_Type.ZT_ScientificName: Zoological_Taxonomy_Info darwinCoreInfo9 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo9 != null && darwinCoreInfo9.Scientific_Name.Length > 0 ? 1 : 0); case Element_Type.ZT_SpecificEpithet: Zoological_Taxonomy_Info darwinCoreInfo10 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo10 != null && darwinCoreInfo10.Specific_Epithet.Length > 0 ? 1 : 0); case Element_Type.ZT_TaxonRank: Zoological_Taxonomy_Info darwinCoreInfo11 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo11 != null && darwinCoreInfo11.Taxonomic_Rank.Length > 0 ? 1 : 0); default: return(0); } }
private bool Write_Metadata_Section(TextWriter Output_Stream, GeoSpatial_Information geoInfo, Dictionary <string, object> Options) { Output_Stream.WriteLine("<gml:FeatureCollection>"); //for points foreach (Coordinate_Point thisPoint in geoInfo.Points) { Output_Stream.WriteLine("<gml:featureMember>"); if (thisPoint.Label.Length > 0) { Output_Stream.WriteLine("<gml:Point featureType=\"" + Convert_String_To_XML_Safe(thisPoint.FeatureType) + "\" label=\"" + Convert_String_To_XML_Safe(thisPoint.Label) + "\">"); } else { Output_Stream.WriteLine("<gml:Point featureType=\"" + Convert_String_To_XML_Safe(thisPoint.FeatureType) + "\">"); } Output_Stream.Write("<gml:Coordinates>"); Output_Stream.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:Point>"); Output_Stream.WriteLine("</gml:featureMember>"); } //for lines foreach (Coordinate_Line thisLine in geoInfo.Lines) { Output_Stream.WriteLine("<gml:featureMember>"); if (thisLine.Label.Length > 0) { Output_Stream.WriteLine("<gml:Line featureType=\"" + Convert_String_To_XML_Safe(thisLine.FeatureType) + "\" label=\"" + Convert_String_To_XML_Safe(thisLine.Label) + "\">"); } else { Output_Stream.WriteLine("<gml:Line featureType=\"" + Convert_String_To_XML_Safe(thisLine.FeatureType) + "\">"); } Output_Stream.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long { Output_Stream.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:Line>"); Output_Stream.WriteLine("</gml:featureMember>"); } //for polygons foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates { Output_Stream.WriteLine("<gml:featureMember>"); if (thisPolygon.Label.Length > 0) { Output_Stream.WriteLine("<gml:Polygon pageId=\"" + Convert_String_To_XML_Safe(thisPolygon.Page_Sequence.ToString()) + "\" featureType=\"" + Convert_String_To_XML_Safe(thisPolygon.FeatureType) + "\" polygonType=\"" + Convert_String_To_XML_Safe(thisPolygon.PolygonType) + "\" label=\"" + Convert_String_To_XML_Safe(thisPolygon.Label) + "\" rotation=\"" + thisPolygon.Rotation + "\">"); } else { Output_Stream.WriteLine("<gml:Polygon pageId=\"" + Convert_String_To_XML_Safe(thisPolygon.Page_Sequence.ToString()) + "\" featureType=\"" + Convert_String_To_XML_Safe(thisPolygon.FeatureType) + "\" polygonType=\"" + Convert_String_To_XML_Safe(thisPolygon.PolygonType) + "\" rotation=\"" + thisPolygon.Rotation + "\">"); } Output_Stream.WriteLine("<gml:exterior>"); Output_Stream.WriteLine("<gml:LinearRing>"); Output_Stream.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long { Output_Stream.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:LinearRing>"); Output_Stream.WriteLine("</gml:exterior>"); Output_Stream.WriteLine("</gml:Polygon>"); Output_Stream.WriteLine("</gml:featureMember>"); } //for circles foreach (Coordinate_Circle thisCircle in geoInfo.Circles) { Output_Stream.WriteLine("<gml:featureMember>"); if (thisCircle.Label.Length > 0) { Output_Stream.WriteLine("<gml:Circle featureType=\"" + Convert_String_To_XML_Safe(thisCircle.FeatureType) + "\" label=\"" + Convert_String_To_XML_Safe(thisCircle.Label) + "\" radius=\"" + Convert_String_To_XML_Safe(thisCircle.Radius.ToString()) + "\">"); } else { Output_Stream.WriteLine("<gml:Circle featureType=\"" + Convert_String_To_XML_Safe(thisCircle.FeatureType) + "\" radius=\"" + Convert_String_To_XML_Safe(thisCircle.Radius.ToString()) + "\">"); } Output_Stream.Write("<gml:Coordinates>"); Output_Stream.Write(thisCircle.Latitude + "," + thisCircle.Longitude + " "); Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:Circle>"); Output_Stream.WriteLine("</gml:featureMember>"); } Output_Stream.WriteLine("</gml:FeatureCollection>"); return(true); }
private bool Read_Metadata_Section(XmlReader Input_XmlReader, GeoSpatial_Information geoInfo, Dictionary <string, object> Options) { do // Loop through reading each XML node { // get the right division information based on node type if (Input_XmlReader.NodeType == XmlNodeType.Element) //if it is an element { switch (Input_XmlReader.Name) //get name of { case "gml:Point": //is a point //read the featureType string pointFeatureType = String.Empty; if (Input_XmlReader.MoveToAttribute("featureType")) { pointFeatureType = Input_XmlReader.Value; } //read the label string pointLabel = String.Empty; if (Input_XmlReader.MoveToAttribute("label")) { pointLabel = Input_XmlReader.Value; } //get the rest of the information do { //check to see if end of element if (Input_XmlReader.NodeType == XmlNodeType.EndElement && Input_XmlReader.Name == "gml:Point") { break; } //if it is an element if (Input_XmlReader.NodeType == XmlNodeType.Element) { //determine the name of that element switch (Input_XmlReader.Name) { //if it is the coordinates case "gml:Coordinates": Input_XmlReader.Read(); if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0)) { //get coordinates string result = Convert.ToString(Input_XmlReader.Value); var items = result.Split(','); double latitude = double.Parse(items[0]); double longitude = double.Parse(items[1]); //add point to geo obj geoInfo.Add_Point(latitude, longitude, pointLabel, pointFeatureType); } break; } } } while (Input_XmlReader.Read()); break; case "gml:Line": //is a line //read the featureType string lineFeatureType = String.Empty; if (Input_XmlReader.MoveToAttribute("featureType")) { lineFeatureType = Input_XmlReader.Value; } //read the label string lineLabel = String.Empty; if (Input_XmlReader.MoveToAttribute("label")) { lineLabel = Input_XmlReader.Value; } //get the rest do { //check to see if end of element if (Input_XmlReader.NodeType == XmlNodeType.EndElement && Input_XmlReader.Name == "gml:Line") { break; } //if it is an element if (Input_XmlReader.NodeType == XmlNodeType.Element) { //determine the name of that element switch (Input_XmlReader.Name) { //if it is the coordinates case "gml:Coordinates": Input_XmlReader.Read(); if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0)) { // Parse the string into a collection of doubles, which represents lats AND longs List <double> latLongs = new List <double>(); string rValue = Input_XmlReader.Value + ' '; StringBuilder coordinatePointBuilder = new StringBuilder(); for (int iterator = 0; iterator < rValue.Length; iterator++) { char rValueChar = rValue[iterator]; if ((Char.IsNumber(rValueChar)) || (rValueChar == '.') || (rValueChar == '-')) { coordinatePointBuilder.Append(rValueChar); } else { if (coordinatePointBuilder.Length > 0) { latLongs.Add(double.Parse(coordinatePointBuilder.ToString())); coordinatePointBuilder.Remove(0, coordinatePointBuilder.Length); } } } //create newline obj Coordinate_Line newline = new Coordinate_Line(); //add points, In pairs, assign new points to the line and add the line to the coordinate/item int i = 0; while ((i + 2) <= latLongs.Count) { string lineName = "line"; lineName += i; newline.Add_Point(latLongs[i], latLongs[i + 1], lineName); i += 2; } //add featureType newline.FeatureType = lineFeatureType; //add label newline.Label = lineLabel; //add line to geo obj geoInfo.Add_Line(newline); } break; } } } while (Input_XmlReader.Read()); break; case "gml:Polygon": //is polygon //read the featuretype string polygonFeatureType = String.Empty; if (Input_XmlReader.MoveToAttribute("featureType")) { polygonFeatureType = Input_XmlReader.Value; } //read the polygonType string polygonPolygonType = String.Empty; if (Input_XmlReader.MoveToAttribute("polygonType")) { polygonPolygonType = Input_XmlReader.Value; } //read the label string polygonLabel = String.Empty; if (Input_XmlReader.MoveToAttribute("label")) { polygonLabel = Input_XmlReader.Value; } //read the rotation double polygonRotation = 0; if (Input_XmlReader.MoveToAttribute("rotation")) { polygonRotation = Convert.ToDouble(Input_XmlReader.Value); } //get the rest do { //check to see if end of element if (Input_XmlReader.NodeType == XmlNodeType.EndElement && Input_XmlReader.Name == "gml:Polygon") { break; } //if it is an element if (Input_XmlReader.NodeType == XmlNodeType.Element) { //determine the name of that element switch (Input_XmlReader.Name) { //if it is the coordinates case "gml:Coordinates": Input_XmlReader.Read(); if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0)) { // Parse the string into a collection of doubles, which represents lats AND longs List <double> latLongs = new List <double>(); string rValue = Input_XmlReader.Value + ' '; StringBuilder coordinatePointBuilder = new StringBuilder(); for (int iterator = 0; iterator < rValue.Length; iterator++) { char rValueChar = rValue[iterator]; if ((Char.IsNumber(rValueChar)) || (rValueChar == '.') || (rValueChar == '-')) { coordinatePointBuilder.Append(rValueChar); } else { if (coordinatePointBuilder.Length > 0) { latLongs.Add(double.Parse(coordinatePointBuilder.ToString())); coordinatePointBuilder.Remove(0, coordinatePointBuilder.Length); } } } //create a newpoly obj Coordinate_Polygon newPoly = new Coordinate_Polygon(); //add the edgepoints, In pairs, assign new points to the polygon and add the polygon to the coordinate/item int i = 0; while ((i + 2) <= latLongs.Count) { newPoly.Add_Edge_Point(latLongs[i], latLongs[i + 1]); i += 2; } //add the featuretype newPoly.FeatureType = polygonFeatureType; //add the polygontype newPoly.PolygonType = polygonPolygonType; //add the label newPoly.Label = polygonLabel; //add the rotation newPoly.Rotation = polygonRotation; //add poly to geo obj geoInfo.Add_Polygon(newPoly); } break; } } } while (Input_XmlReader.Read()); break; case "gml:Circle": //is a circle //read the featureType string circleFeatureType = String.Empty; if (Input_XmlReader.MoveToAttribute("featureType")) { circleFeatureType = Input_XmlReader.Value; } //read the label string circleLabel = String.Empty; if (Input_XmlReader.MoveToAttribute("label")) { circleLabel = Input_XmlReader.Value; } //read the radius double circleRadius = 0; if (Input_XmlReader.MoveToAttribute("radius")) { circleRadius = Convert.ToDouble(Input_XmlReader.Value); } //get the rest do { //check to see if end of element if (Input_XmlReader.NodeType == XmlNodeType.EndElement && Input_XmlReader.Name == "gml:Circle") { break; } //if it is an element if (Input_XmlReader.NodeType == XmlNodeType.Element) { //determine the name of that element switch (Input_XmlReader.Name) { //if it is the coordinates case "gml:Coordinates": Input_XmlReader.Read(); if ((Input_XmlReader.NodeType == XmlNodeType.Text) && (Input_XmlReader.Value.Trim().Length > 0)) { string result = Convert.ToString(Input_XmlReader.Value); var items = result.Split(','); double latitude = double.Parse(items[0]); double longitude = double.Parse(items[1]); //create the circle Coordinate_Circle newCircle = new Coordinate_Circle(latitude, longitude, circleRadius, circleLabel, circleFeatureType); //add to object geoInfo.Add_Circle(newCircle); } break; } } } while (Input_XmlReader.Read()); break; } } } while (Input_XmlReader.Read()); return(true); }
private bool Write_Metadata_Section(TextWriter Output_Stream, GeoSpatial_Information geoInfo, Dictionary <string, object> Options) { Output_Stream.WriteLine("<gml:FeatureCollection>"); //for points foreach (Coordinate_Point thisPoint in geoInfo.Points) { Output_Stream.WriteLine("<gml:featureMember>"); if (thisPoint.Label.Length > 0) { Output_Stream.WriteLine("<gml:Point label=\"" + Convert_String_To_XML_Safe(thisPoint.Label) + "\">"); } else { Output_Stream.WriteLine("<gml:Point>"); } Output_Stream.Write("<gml:Coordinates>"); Output_Stream.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:Point>"); Output_Stream.WriteLine("</gml:featureMember>"); } //for lines foreach (Coordinate_Line thisLine in geoInfo.Lines) { Output_Stream.WriteLine("<gml:featureMember>"); if (thisLine.Label.Length > 0) { Output_Stream.WriteLine("<gml:Line label=\"" + Convert_String_To_XML_Safe(thisLine.Label) + "\">"); } else { Output_Stream.WriteLine("<gml:Line>"); } Output_Stream.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long { Output_Stream.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:Line>"); Output_Stream.WriteLine("</gml:featureMember>"); } //for polygons foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates { Output_Stream.WriteLine("<gml:featureMember>"); if (thisPolygon.Label.Length > 0) { Output_Stream.WriteLine("<gml:Polygon label=\"" + Convert_String_To_XML_Safe(thisPolygon.Label) + "\">"); } else { Output_Stream.WriteLine("<gml:Polygon>"); } Output_Stream.WriteLine("<gml:exterior>"); Output_Stream.WriteLine("<gml:LinearRing>"); Output_Stream.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long { Output_Stream.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } Output_Stream.WriteLine("</gml:Coordinates>"); Output_Stream.WriteLine("</gml:LinearRing>"); Output_Stream.WriteLine("</gml:exterior>"); Output_Stream.WriteLine("</gml:Polygon>"); Output_Stream.WriteLine("</gml:featureMember>"); } Output_Stream.WriteLine("</gml:FeatureCollection>"); return(true); }
/// <summary> Builds an item group object, from a METS file </summary> /// <param name="BibID"> Bibliographic identifier for the item group to retrieve </param> /// <param name="Icon_Dictionary"> Dictionary of information about every wordmark/icon in this digital library, used to build the HTML for the icons linked to this digital resource</param> /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param> public SobekCM_Item Build_Item_Group(string BibID, Dictionary <string, Wordmark_Icon> Icon_Dictionary, Custom_Tracer Tracer) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Item_Group", "Create the requested item group"); } // Get the basic information about this item DataSet itemDetails = Engine_Database.Get_Item_Group_Details(BibID, Tracer); // If this is NULL then there was an error if (itemDetails == null) { if (Tracer != null) { Tracer.Add_Trace("SobekCM_METS_Based_ItemBuilder.Build_Item_Group", "Call to database for this BibID failed and returned NULL"); } return(null); } // Get the location for the METS file from the returned value DataRow mainItemRow = itemDetails.Tables[0].Rows[0]; string metsLocation = mainItemRow["File_Location"].ToString(); // Get the response object for this METS file string metsFile = metsLocation.Replace("\\", "/") + "/" + BibID + ".xml"; if (metsFile.IndexOf("http:") < 0) { metsFile = Engine_ApplicationCache_Gateway.Settings.Servers.Image_Server_Network + metsFile; } // Try to read this METS file bool pulledFromMETSFile = true; SobekCM_Item Item_Group_Object = Build_Item_From_METS(metsFile, BibID + ".xml", Tracer); // If this failed, just create an item from scratch if (Item_Group_Object == null) { Item_Group_Object = new SobekCM_Item(); Item_Group_Object.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial; Item_Group_Object.BibID = BibID; pulledFromMETSFile = false; } // Set some default and add the management view Item_Group_Object.METS_Header.RecordStatus_Enum = METS_Record_Status.BIB_LEVEL; Item_Group_Object.Behaviors.Add_View("MANAGE"); // Pull values from the database Item_Group_Object.Behaviors.GroupTitle = String.Empty; Item_Group_Object.Behaviors.Set_Primary_Identifier(mainItemRow["Primary_Identifier_Type"].ToString(), mainItemRow["Primary_Identifier"].ToString()); Item_Group_Object.Behaviors.Text_Searchable = false; Item_Group_Object.Web.File_Root = String.Empty; Item_Group_Object.Web.Image_Root = Engine_ApplicationCache_Gateway.Settings.Servers.Image_URL; Item_Group_Object.Web.Siblings = 2; Item_Group_Object.Web.Static_PageCount = 0; Item_Group_Object.Web.Static_Division_Count = 0; Item_Group_Object.Web.AssocFilePath = "/" + BibID.Substring(0, 2) + "/" + BibID[2] + BibID[6] + "/" + BibID[4] + BibID[8] + "/" + BibID[3] + BibID[7] + "/" + BibID[5] + BibID[9] + "/"; Item_Group_Object.Web.GroupID = Convert.ToInt32(mainItemRow["GroupID"]); // Add the full citation view and google map if pulled from the METS file if (pulledFromMETSFile) { // GEt the geospatial metadata module GeoSpatial_Information geoInfo = Item_Group_Object.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo != null) && (geoInfo.hasData)) { // In addition, if there is a latitude or longitude listed, add the Google Maps if ((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0)) { Item_Group_Object.Behaviors.Insert_View(0, "GOOGLE_MAP"); } } Item_Group_Object.Behaviors.Insert_View(0, "CITATION"); } // If this has more than 1 sibling (this count includes itself), add the multi-volumes viewer Item_Group_Object.Behaviors.Insert_View(0, "ALL_VOLUMES", String.Empty, Item_Group_Object.Bib_Info.SobekCM_Type_String); // Pull the data from the database Item_Group_Object.Behaviors.GroupType = mainItemRow["Type"].ToString(); Item_Group_Object.Behaviors.GroupTitle = mainItemRow["GroupTitle"].ToString(); Item_Group_Object.Web.File_Root = mainItemRow["File_Location"].ToString(); // Add the database information to the icons now Item_Group_Object.Behaviors.Clear_Wordmarks(); foreach (DataRow iconRow in itemDetails.Tables[1].Rows) { string image = iconRow[0].ToString(); string link = iconRow[1].ToString().Replace("&", "&").Replace("\"", """); string code = iconRow[2].ToString(); string name = iconRow[3].ToString(); if (name.Length == 0) { name = code.Replace("&", "&").Replace("\"", """); } string html; if (link.Length == 0) { html = "<img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" title=\"" + name + "\" alt=\"" + name + "\" />"; } else { if (link[0] == '?') { html = "<a href=\"" + link + "\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" alt=\"" + name + "\" /></a>"; } else { html = "<a href=\"" + link + "\" target=\"_blank\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" alt=\"" + name + "\" /></a>"; } } Wordmark_Info newIcon = new Wordmark_Info { HTML = html, Link = link, Title = name, Code = code }; Item_Group_Object.Behaviors.Add_Wordmark(newIcon); } // Add the web skin codes to this bib-level item as well Item_Group_Object.Behaviors.Clear_Web_Skins(); foreach (DataRow thisRow in itemDetails.Tables[2].Rows) { Item_Group_Object.Behaviors.Add_Web_Skin(thisRow[0].ToString().ToUpper()); } // Set the aggregationPermissions in the package to the aggregation links from the database Item_Group_Object.Behaviors.Clear_Aggregations(); DataTable aggrTable = itemDetails.Tables[3]; foreach (DataRow thisRow in aggrTable.Rows) { Item_Group_Object.Behaviors.Add_Aggregation(thisRow[0].ToString()); } // Add the related titles, if there are some foreach (DataRow thisRow in itemDetails.Tables[4].Rows) { string relationship = thisRow["Relationship"].ToString(); string title = thisRow["GroupTitle"].ToString(); string bibid = thisRow["BibID"].ToString(); Item_Group_Object.Web.All_Related_Titles.Add(new Related_Titles(relationship, title, "<%BASEURL%>" + bibid + "<%URL_OPTS%>\">")); } return(Item_Group_Object); }
public void Set_Coordinates(GeoSpatial_Information Coords) { coords = Coords; // Display the data kmlTextBox.Text = Coords.KML_Reference; if (Coords.Point_Count > 0) { point1LatitudeTextBox.Text = Coords.Points[0].Latitude.ToString(); point1LongitudeTextBox.Text = Coords.Points[0].Longitude.ToString(); point1LabelTextBox.Text = Coords.Points[0].Label; } if (Coords.Point_Count > 1) { point2LatitudeTextBox.Text = Coords.Points[1].Latitude.ToString(); point2LongitudeTextBox.Text = Coords.Points[1].Longitude.ToString(); point2LabelTextBox.Text = Coords.Points[1].Label; } if (Coords.Point_Count > 2) { point3LatitudeTextBox.Text = Coords.Points[2].Latitude.ToString(); point3LongitudeTextBox.Text = Coords.Points[2].Longitude.ToString(); point3LabelTextBox.Text = Coords.Points[2].Label; } if (Coords.Point_Count > 3) { point4LatitudeTextBox.Text = Coords.Points[3].Latitude.ToString(); point4LongitudeTextBox.Text = Coords.Points[3].Longitude.ToString(); point4LabelTextBox.Text = Coords.Points[3].Label; } if (Coords.Point_Count > 4) { point5LatitudeTextBox.Text = Coords.Points[4].Latitude.ToString(); point5LongitudeTextBox.Text = Coords.Points[4].Longitude.ToString(); point5LabelTextBox.Text = Coords.Points[4].Label; } if (Coords.Polygon_Count > 0) { Coordinate_Polygon polygon = Coords.Get_Polygon(0); polyLabelTextBox.Text = polygon.Label; if (polygon.Edge_Points_Count > 0) { poly1LatitudeTextBox.Text = polygon.Edge_Points[0].Latitude.ToString(); poly1LongitudeTextBox.Text = polygon.Edge_Points[0].Longitude.ToString(); } if (polygon.Edge_Points_Count > 1) { poly2LatitudeTextBox.Text = polygon.Edge_Points[1].Latitude.ToString(); poly2LongitudeTextBox.Text = polygon.Edge_Points[1].Longitude.ToString(); } if (polygon.Edge_Points_Count > 2) { poly3LatitudeTextBox.Text = polygon.Edge_Points[2].Latitude.ToString(); poly3LongitudeTextBox.Text = polygon.Edge_Points[2].Longitude.ToString(); } if (polygon.Edge_Points_Count > 3) { poly4LatitudeTextBox.Text = polygon.Edge_Points[3].Latitude.ToString(); poly4LongitudeTextBox.Text = polygon.Edge_Points[3].Longitude.ToString(); } if (polygon.Edge_Points_Count > 4) { poly5LatitudeTextBox.Text = polygon.Edge_Points[4].Latitude.ToString(); poly5LongitudeTextBox.Text = polygon.Edge_Points[4].Longitude.ToString(); } if (polygon.Edge_Points_Count > 5) { poly6LatitudeTextBox.Text = polygon.Edge_Points[5].Latitude.ToString(); poly6LongitudeTextBox.Text = polygon.Edge_Points[5].Longitude.ToString(); } } point1LatitudeTextBox.TextChanged += textChanged; kmlTextBox.TextChanged += textChanged; point1LabelTextBox.TextChanged += textChanged; point1LongitudeTextBox.TextChanged += textChanged; point3LabelTextBox.TextChanged += textChanged; point3LongitudeTextBox.TextChanged += textChanged; point3LatitudeTextBox.TextChanged += textChanged; point2LabelTextBox.TextChanged += textChanged; point2LongitudeTextBox.TextChanged += textChanged; point5LabelTextBox.TextChanged += textChanged; point5LongitudeTextBox.TextChanged += textChanged; point5LatitudeTextBox.TextChanged += textChanged; point4LabelTextBox.TextChanged += textChanged; point4LongitudeTextBox.TextChanged += textChanged; point4LatitudeTextBox.TextChanged += textChanged; point2LatitudeTextBox.TextChanged += textChanged; point2LongitudeTextBox.TextChanged += textChanged; poly5LongitudeTextBox.TextChanged += textChanged; poly5LatitudeTextBox.TextChanged += textChanged; poly4LongitudeTextBox.TextChanged += textChanged; poly4LatitudeTextBox.TextChanged += textChanged; poly3LongitudeTextBox.TextChanged += textChanged; poly3LatitudeTextBox.TextChanged += textChanged; poly2LongitudeTextBox.TextChanged += textChanged; poly2LatitudeTextBox.TextChanged += textChanged; poly1LongitudeTextBox.TextChanged += textChanged; poly1LatitudeTextBox.TextChanged += textChanged; poly6LongitudeTextBox.TextChanged += textChanged; poly6LatitudeTextBox.TextChanged += textChanged; polyLabelTextBox.TextChanged += textChanged; }
//new GML Writer private bool Write_GMLFile(System.IO.TextWriter GMLOutput, SobekCM_Item METS_Item, Dictionary <string, object> Options) { //2do confirm that this outputs a string of goodies ready to place in a GML file // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { return(true); } string GMLSchemaURL = "http://www.opengis.net/gml"; //create header //2do: add custom schema string imageURL = "http://ufdc.ufl.edu/"; //create imageURL imageURL += METS_Item.BibID; imageURL += "/"; imageURL += METS_Item.VID; string featureCollectionURL = imageURL; //create collectionURL GMLOutput.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //write header GMLOutput.WriteLine("<gml:FeatureCollection xmlns:gml=\"" + GMLSchemaURL + "\">"); GMLOutput.WriteLine("<sobekCM:Collection URI=\"" + featureCollectionURL + "\">"); //write collectionURL //for points foreach (Coordinate_Point thisPoint in geoInfo.Points) { string featureMemberURL = imageURL; GMLOutput.WriteLine("<gml:featureMember>"); GMLOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">"); GMLOutput.WriteLine("<gml:Point>"); GMLOutput.Write("<gml:Coordinates>"); GMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); GMLOutput.Write("</gml:Coordinates>"); GMLOutput.WriteLine(); //add line break GMLOutput.WriteLine("</gml:Point>"); GMLOutput.WriteLine("</sobekCM:Item>"); GMLOutput.WriteLine("</gml:featureMember>"); } //for lines foreach (Coordinate_Line thisLine in geoInfo.Lines) { string featureMemberURL = imageURL; GMLOutput.WriteLine("<gml:featureMember>"); GMLOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">"); GMLOutput.WriteLine("<gml:boundedBy>"); GMLOutput.WriteLine("<gml:Box>"); GMLOutput.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long { GMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } GMLOutput.Write("</gml:Coordinates>"); GMLOutput.WriteLine(); //add line break GMLOutput.WriteLine("</gml:Box>"); GMLOutput.WriteLine("</gml:boundedBy>"); GMLOutput.WriteLine("</sobekCM:Item>"); GMLOutput.WriteLine("</gml:featureMember>"); } //for polygons foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates { string featureMemberURL = imageURL; featureMemberURL += "/"; featureMemberURL += thisPolygon.Page_Sequence; GMLOutput.WriteLine("<gml:featureMember>"); GMLOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">"); GMLOutput.WriteLine("<gml:Polygon>"); GMLOutput.WriteLine("<gml:exterior>"); GMLOutput.WriteLine("<gml:LinearRing>"); GMLOutput.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long { GMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); //gml } GMLOutput.Write("</gml:Coordinates>"); GMLOutput.WriteLine(); //gml, add line break GMLOutput.WriteLine("</gml:LinearRing>"); GMLOutput.WriteLine("</gml:exterior>"); GMLOutput.WriteLine("</gml:Polygon>"); GMLOutput.WriteLine("<sobekCM:/Item>"); GMLOutput.WriteLine("</gml:featureMember>"); } //send closing gml tags and close gml file GMLOutput.WriteLine("</sobekCM:Collection>"); GMLOutput.WriteLine("</gml:FeatureCollection>"); GMLOutput.Flush(); GMLOutput.Close(); return(true); }
/// <summary> Create a test digital resource item </summary> /// <param name="directory">Directory for the package source directory</param> /// <returns>Fully built test bib package</returns> public static SobekCM_Item Create(string directory) { SobekCM_Item testPackage = new SobekCM_Item(); // Add all the METS header information testPackage.METS_Header.Create_Date = new DateTime(2007, 1, 1); testPackage.METS_Header.Modify_Date = DateTime.Now; testPackage.METS_Header.Creator_Individual = "Mark Sullivan"; testPackage.METS_Header.Add_Creator_Individual_Notes("Programmer of new SobekCM.Resource_Object"); testPackage.METS_Header.Add_Creator_Individual_Notes("Adding coordinates"); testPackage.METS_Header.Creator_Organization = "University of Florida"; testPackage.METS_Header.Creator_Software = "SobekCM Bib Package Test"; testPackage.METS_Header.RecordStatus_Enum = METS_Record_Status.COMPLETE; testPackage.METS_Header.Add_Creator_Org_Notes("This test package was done to test DLCs new METS package"); // Add all the MODS elements Abstract_Info testAbstract = testPackage.Bib_Info.Add_Abstract("This is a sample abstract", "en"); testPackage.Bib_Info.Add_Abstract("Tämä on esimerkki abstrakteja", "fin"); testAbstract.Display_Label = "Summary Abstract"; testAbstract.Type = "summary"; testPackage.Bib_Info.Access_Condition.Text = "All rights are reserved by source institution."; testPackage.Bib_Info.Access_Condition.Language = "en"; testPackage.Bib_Info.Access_Condition.Type = "restrictions on use"; testPackage.Bib_Info.Access_Condition.Display_Label = "Rights"; testPackage.Bib_Info.Add_Identifier("000123234", "OCLC", "Electronic OCLC"); testPackage.Bib_Info.Add_Identifier("182-asdsd-28k", "DOI"); testPackage.Bib_Info.Add_Language("English", String.Empty, "en"); testPackage.Bib_Info.Add_Language("Finnish"); testPackage.Bib_Info.Add_Language(String.Empty, "ita", String.Empty); testPackage.Bib_Info.Location.Holding_Code = "MVS"; testPackage.Bib_Info.Location.Holding_Name = "From the Private Library of Mark Sullivan"; testPackage.Bib_Info.Location.PURL = "http://www.uflib.ufl.edu/ufdc/?b=CA00000000"; testPackage.Bib_Info.Location.Other_URL = "http://www.fnhm.edu"; testPackage.Bib_Info.Location.Other_URL_Display_Label = "Specimen Information"; testPackage.Bib_Info.Location.Other_URL_Note = "Specimen FLAS 125342 Database"; testPackage.Bib_Info.Location.EAD_URL = "http://digital.uflib.ufl.edu/"; testPackage.Bib_Info.Location.EAD_Name = "Digital Library Center Finding Guide"; testPackage.Bib_Info.Main_Entity_Name.Name_Type = Name_Info_Type_Enum.personal; testPackage.Bib_Info.Main_Entity_Name.Full_Name = "Brown, B.F."; testPackage.Bib_Info.Main_Entity_Name.Terms_Of_Address = "Dr."; testPackage.Bib_Info.Main_Entity_Name.Display_Form = "B.F. Brown"; testPackage.Bib_Info.Main_Entity_Name.Affiliation = "Chemistry Dept., American University"; testPackage.Bib_Info.Main_Entity_Name.Description = "Chemistry Professor Emeritus"; testPackage.Bib_Info.Main_Entity_Name.Add_Role("Author"); Zoological_Taxonomy_Info taxonInfo = new Zoological_Taxonomy_Info(); testPackage.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, taxonInfo); taxonInfo.Scientific_Name = "Ctenomys sociabilis"; taxonInfo.Higher_Classification = "Animalia; Chordata; Vertebrata; Mammalia; Theria; Eutheria; Rodentia; Hystricognatha; Hystricognathi; Ctenomyidae; Ctenomyini; Ctenomys"; taxonInfo.Kingdom = "Animalia"; taxonInfo.Phylum = "Chordata"; taxonInfo.Class = "Mammalia"; taxonInfo.Order = "Rodentia"; taxonInfo.Family = "Ctenomyidae"; taxonInfo.Genus = "Ctenomys"; taxonInfo.Specific_Epithet = "sociabilis"; taxonInfo.Taxonomic_Rank = "species"; taxonInfo.Common_Name = "Social Tuco-Tuco"; Name_Info name1 = new Name_Info(); name1.Name_Type = Name_Info_Type_Enum.personal; name1.Given_Name = "John Paul"; name1.Terms_Of_Address = "Pope; II"; name1.Dates = "1920-2002"; name1.User_Submitted = true; testPackage.Bib_Info.Add_Named_Entity(name1); Name_Info name2 = new Name_Info(); name2.Name_Type = Name_Info_Type_Enum.conference; name2.Full_Name = "Paris Peace Conference (1919-1920)"; name2.Dates = "1919-1920"; testPackage.Bib_Info.Add_Named_Entity(name2); Name_Info name3 = new Name_Info(); name3.Name_Type = Name_Info_Type_Enum.corporate; name3.Full_Name = "United States -- Court of Appeals (2nd Court)"; testPackage.Bib_Info.Add_Named_Entity(name3); Name_Info name4 = new Name_Info(); name4.Name_Type = Name_Info_Type_Enum.personal; name4.Full_Name = "Wilson, Mary"; name4.Display_Form = "Mary 'Weels' Wilson"; name4.Given_Name = "Mary"; name4.Family_Name = "Wilson"; name4.ID = "NAM4"; name4.Terms_Of_Address = "2nd"; name4.Add_Role("illustrator"); name4.Add_Role("cartographer"); testPackage.Bib_Info.Add_Named_Entity(name4); Name_Info donor = new Name_Info(); donor.Name_Type = Name_Info_Type_Enum.personal; donor.Full_Name = "Livingston, Arthur"; donor.Description = "Gift in honor of Arthur Livingston"; donor.Terms_Of_Address = "3rd"; donor.Add_Role("honoree", String.Empty); testPackage.Bib_Info.Donor = donor; testPackage.Bib_Info.Main_Title.NonSort = "The "; testPackage.Bib_Info.Main_Title.Title = "Man Who Would Be King"; testPackage.Bib_Info.Main_Title.Subtitle = "The story of succession in England"; Title_Info title1 = new Title_Info("homme qui voulut être roi", Title_Type_Enum.translated); title1.NonSort = "L'"; title1.Language = "fr"; testPackage.Bib_Info.Add_Other_Title(title1); Title_Info title2 = new Title_Info(); title2.Title = "Man Who Be King"; title2.Display_Label = "also known as"; title2.NonSort = "The"; title2.Title_Type = Title_Type_Enum.alternative; testPackage.Bib_Info.Add_Other_Title(title2); Title_Info title3 = new Title_Info(); title3.Title = "Great works of England"; title3.Authority = "naf"; title3.Add_Part_Name("Second Portion"); title3.Add_Part_Number("2nd"); title3.Title_Type = Title_Type_Enum.uniform; title3.User_Submitted = true; testPackage.Bib_Info.Add_Other_Title(title3); testPackage.Bib_Info.Add_Note("Funded by the NEH", Note_Type_Enum.funding); testPackage.Bib_Info.Add_Note("Based on a play which originally appeared in France as \"Un peu plus tard, un peu plus tôt\"").User_Submitted = true; testPackage.Bib_Info.Add_Note("Anne Baxter (Louise), Maria Perschy (Angela), Gustavo Rojo (Bill), Reginald Gilliam (Mr. Johnson), [Catherine Elliot?] (Aunt Sallie), Ben Tatar (waiter)", Note_Type_Enum.performers, "Performed By"); testPackage.Bib_Info.Origin_Info.Add_Place("New York", "nyu", "usa"); testPackage.Bib_Info.Origin_Info.Date_Issued = "1992"; testPackage.Bib_Info.Origin_Info.MARC_DateIssued_Start = "1992"; testPackage.Bib_Info.Origin_Info.MARC_DateIssued_End = "1993"; testPackage.Bib_Info.Origin_Info.Date_Copyrighted = "1999"; testPackage.Bib_Info.Origin_Info.Edition = "2nd"; Publisher_Info newPub = testPackage.Bib_Info.Add_Publisher("Published for the American Vacuum Society by the American Institute of Physics"); newPub.Add_Place("New York, New York"); newPub.User_Submitted = true; testPackage.Bib_Info.Add_Publisher("University of Florida Press House").Add_Place("Gainesville, FL"); testPackage.Bib_Info.Add_Manufacturer("Addison Randly Publishing House"); testPackage.Bib_Info.Original_Description.Extent = "1 sound disc (56 min.) : digital ; 3/4 in."; testPackage.Bib_Info.Original_Description.Add_Note("The sleeve of this sound disc was damaged in a fire"); testPackage.Bib_Info.Original_Description.Add_Note("The disc has a moderate amount of scratches, but still plays"); testPackage.Bib_Info.Series_Part_Info.Day = "18"; testPackage.Bib_Info.Series_Part_Info.Day_Index = 18; testPackage.Bib_Info.Series_Part_Info.Month = "Syyskuu"; testPackage.Bib_Info.Series_Part_Info.Month_Index = 9; testPackage.Bib_Info.Series_Part_Info.Year = "1992"; testPackage.Bib_Info.Series_Part_Info.Year_Index = 1992; testPackage.Bib_Info.Series_Part_Info.Enum1 = "Volume 12"; testPackage.Bib_Info.Series_Part_Info.Enum1_Index = 12; testPackage.Bib_Info.Series_Part_Info.Enum2 = "Issue 3"; testPackage.Bib_Info.Series_Part_Info.Enum2_Index = 3; testPackage.Bib_Info.Series_Part_Info.Enum3 = "Part 1"; testPackage.Bib_Info.Series_Part_Info.Enum3_Index = 1; testPackage.Behaviors.Serial_Info.Add_Hierarchy(1, 1992, "1992"); testPackage.Behaviors.Serial_Info.Add_Hierarchy(2, 9, "Syyskuu"); testPackage.Behaviors.Serial_Info.Add_Hierarchy(3, 18, "18"); testPackage.Bib_Info.SeriesTitle.Title = "Shakespeare's most famous musicals"; testPackage.Bib_Info.Add_Target_Audience("young adults"); testPackage.Bib_Info.Add_Target_Audience("adolescent", "marctarget"); testPackage.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper; // Add cartographic subject Subject_Info_Cartographics newCartographics = testPackage.Bib_Info.Add_Cartographics_Subject(); newCartographics.Scale = "1:2000"; newCartographics.Projection = "Conical Projection"; newCartographics.Coordinates = "E 72°--E 148°/N 13°--N 18°"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical.Continent = "North America"; hierarchical.Country = "United States of America"; hierarchical.State = "Kansas"; hierarchical.County = "Butler"; hierarchical.City = "Augusta"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical2 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical2.Region = "Arctic Ocean"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical3 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical3.Island = "Puerto Rico"; hierarchical3.Language = "English"; hierarchical3.Province = "Provincial"; hierarchical3.Territory = "Puerto Rico"; hierarchical3.Area = "Intercontinental areas (Western Hemisphere)"; // Add a name subject Subject_Info_Name subjname1 = testPackage.Bib_Info.Add_Name_Subject(); subjname1.Authority = "lcsh"; subjname1.Full_Name = "Garcia Lorca, Federico"; subjname1.Dates = "1898-1936"; subjname1.Add_Geographic("Russia"); subjname1.Add_Geographic("Moscow"); subjname1.Add_Genre("maps"); subjname1.User_Submitted = true; // Add a title information subject Subject_Info_TitleInfo subjtitle1 = testPackage.Bib_Info.Add_Title_Subject(); subjtitle1.Title_Type = Title_Type_Enum.uniform; subjtitle1.Authority = "naf"; subjtitle1.Title = "Missale Carnotense"; // Add a standard subject Subject_Info_Standard subject1 = testPackage.Bib_Info.Add_Subject(); subject1.Authority = "lcsh"; subject1.Add_Topic("Real property"); subject1.Add_Geographic("Mississippi"); subject1.Add_Geographic("Tippah County"); subject1.Add_Genre("Maps"); // Add a standard subject Subject_Info_Standard subject2 = testPackage.Bib_Info.Add_Subject(); subject2.Add_Occupation("Migrant laborers"); subject2.Add_Genre("School district case files"); // Add a standard subject Subject_Info_Standard subject3 = testPackage.Bib_Info.Add_Subject(); subject3.Authority = "lctgm"; subject3.Add_Topic("Educational buildings"); subject3.Add_Geographic("Washington (D.C.)"); subject3.Add_Temporal("1890-1910"); // Add a standard subject Subject_Info_Standard subject4 = testPackage.Bib_Info.Add_Subject(); subject4.Authority = "rvm"; subject4.Language = "french"; subject4.Add_Topic("Église catholique"); subject4.Add_Topic("Histoire"); subject4.Add_Temporal("20e siècle"); // Add record information testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("English", "eng", "en")); testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("French", "fre", "fr")); testPackage.Bib_Info.Record.MARC_Creation_Date = "080303"; testPackage.Bib_Info.Record.Add_MARC_Record_Content_Sources("FUG"); testPackage.Bib_Info.Record.Record_Origin = "Imported from (OCLC)001213124"; // Test the items which are in the non-MODS portion of the Bib_Info object testPackage.BibID = "MVS0000001"; testPackage.VID = "00001"; testPackage.Bib_Info.SortDate = 1234; testPackage.Bib_Info.SortTitle = "MAN WHO WOULD BE KING"; testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Recent history"); testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Lähihistoria"); testPackage.Bib_Info.Source.Code = "UF"; testPackage.Bib_Info.Source.Statement = "University of Florida"; // Add an affiliation Affiliation_Info affiliation1 = new Affiliation_Info(); affiliation1.University = "University of Florida"; affiliation1.Campus = "Gainesville Campus"; affiliation1.College = "College of Engineering"; affiliation1.Department = "Computer Engineering Department"; affiliation1.Unit = "Robotics"; affiliation1.Name_Reference = "NAM4"; testPackage.Bib_Info.Add_Affiliation(affiliation1); // Add a related item Related_Item_Info relatedItem1 = new Related_Item_Info(); relatedItem1.SobekCM_ID = "UF00001234"; relatedItem1.Relationship = Related_Item_Type_Enum.preceding; relatedItem1.Publisher = "Gainesville Sun Publishing House"; relatedItem1.Add_Note(new Note_Info("Digitized with funding from NEH", Note_Type_Enum.funding)); relatedItem1.Add_Note(new Note_Info("Gainesville Bee was the precursor to this item")); relatedItem1.Main_Title.NonSort = "The"; relatedItem1.Main_Title.Title = "Gainesville Bee"; relatedItem1.Add_Identifier("01234353", "oclc"); relatedItem1.Add_Identifier("002232311", "aleph"); Name_Info ri_name = new Name_Info(); ri_name.Full_Name = "Hills, Bryan"; ri_name.Terms_Of_Address = "Mr."; ri_name.Name_Type = Name_Info_Type_Enum.personal; ri_name.Add_Role("author"); relatedItem1.Add_Name(ri_name); relatedItem1.URL = @"http://www.uflib.ufl.edu/ufdc/?b=UF00001234"; relatedItem1.URL_Display_Label = "Full Text"; testPackage.Bib_Info.Add_Related_Item(relatedItem1); // Add another related item Related_Item_Info relatedItem2 = new Related_Item_Info(); relatedItem2.Relationship = Related_Item_Type_Enum.succeeding; relatedItem2.SobekCM_ID = "UF00009999"; relatedItem2.Main_Title.NonSort = "The"; relatedItem2.Main_Title.Title = "Daily Sun"; relatedItem2.Add_Identifier("0125437", "oclc"); relatedItem2.Add_Note("Name change occured in Fall 1933"); relatedItem2.Start_Date = "Fall 1933"; relatedItem2.End_Date = "December 31, 1945"; testPackage.Bib_Info.Add_Related_Item(relatedItem2); // Add some processing parameters testPackage.Behaviors.Add_Aggregation("JUV"); testPackage.Behaviors.Add_Aggregation("DLOC"); testPackage.Behaviors.Add_Aggregation("DLOSA1"); testPackage.Behaviors.Add_Aggregation("ALICE"); testPackage.Behaviors.Add_Aggregation("ARTE"); testPackage.Web.GUID = "GUID!"; testPackage.Behaviors.Add_Wordmark("DLOC"); testPackage.Behaviors.Add_Wordmark("UFSPEC"); testPackage.Behaviors.Main_Thumbnail = "00001thm.jpg"; // Add some downloads testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.PDF"); testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.MP2"); testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.MP2"); testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.PDF"); // Add some coordinate information GeoSpatial_Information geoSpatial = new GeoSpatial_Information(); testPackage.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoSpatial); geoSpatial.Add_Point(29.530151, -82.301459, "Lake Wauberg"); geoSpatial.Add_Point(29.634352, -82.350640, "Veterinary School"); Coordinate_Polygon polygon = new Coordinate_Polygon(); polygon.Label = "University of Florida Campus"; polygon.Add_Edge_Point(new Coordinate_Point(29.651435, -82.339869, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.641216, -82.340298, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.629503, -82.371969, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.649645, -82.371712, String.Empty)); polygon.Add_Inner_Point(29.649794, -82.351971, "Stadium"); polygon.Add_Inner_Point(29.650988, -82.341156, "Library"); geoSpatial.Add_Polygon(polygon); Coordinate_Line line = new Coordinate_Line(); line.Label = "Waldo Road"; line.Add_Point(29.652852, -82.310944, "Gainesville"); line.Add_Point(29.716681, -82.268372, String.Empty); line.Add_Point(29.791494, -82.167778, "Waldo"); geoSpatial.Add_Line(line); // Add some performing arts information Performing_Arts_Info partInfo = new Performing_Arts_Info(); testPackage.Add_Metadata_Module("PerformingArts", partInfo); partInfo.Performance = "Hamlet"; partInfo.Performance_Date = "August 12, 1923"; Performer performer1 = partInfo.Add_Performer("Sullivan, Mark"); performer1.Sex = "M"; performer1.LifeSpan = "1873-"; performer1.Occupation = "actor"; performer1.Title = "Mr."; Performer performer2 = partInfo.Add_Performer("Waldbart, Julia"); performer2.Sex = "F"; performer2.LifeSpan = "1876-"; performer2.Occupation = "actress"; performer2.Title = "Mrs."; // Add some oral history information Oral_Interview_Info oralInfo = new Oral_Interview_Info(); testPackage.Add_Metadata_Module("OralInterview", oralInfo); oralInfo.Interviewee = "Edwards, Herm"; oralInfo.Interviewer = "Proctor, Samual"; // Add some learning object resource information LearningObjectMetadata lomInfo = new LearningObjectMetadata(); testPackage.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo); lomInfo.AggregationLevel = AggregationLevelEnum.level3; lomInfo.Status = StatusEnum.draft; LOM_System_Requirements lomReq1 = new LOM_System_Requirements(); lomReq1.RequirementType = RequirementTypeEnum.operating_system; lomReq1.Name.Value = "Windows"; lomReq1.MinimumVersion = "Windows XP"; lomReq1.MaximumVersion = "Windows 7"; lomInfo.Add_SystemRequirements(lomReq1); LOM_System_Requirements lomReq2 = new LOM_System_Requirements(); lomReq2.RequirementType = RequirementTypeEnum.software; lomReq2.Name.Value = "Java SDK"; lomReq2.MinimumVersion = "1.7.1"; lomReq2.MaximumVersion = "2.09"; lomInfo.Add_SystemRequirements(lomReq2); lomInfo.InteractivityType = InteractivityTypeEnum.mixed; lomInfo.Add_LearningResourceType("exercise"); lomInfo.Add_LearningResourceType("Tutorials", "encdlwebpedagogicaltype"); lomInfo.InteractivityLevel = InteractivityLevelEnum.high; lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.learner); lomInfo.Add_Context("Undergraduate lower division", "enclearningcontext"); lomInfo.Add_Context("15", "grade"); lomInfo.Add_Context("16", "grade"); lomInfo.Add_Context("5", "group"); lomInfo.Add_TypicalAgeRange("suitable for children over 7", "en"); lomInfo.Add_TypicalAgeRange("2-8"); lomInfo.DifficultyLevel = DifficultyLevelEnum.medium; lomInfo.TypicalLearningTime = "PT45M"; LOM_Classification lomClassification1 = new LOM_Classification(); lomInfo.Add_Classification(lomClassification1); lomClassification1.Purpose.Value = "Discipline"; LOM_TaxonPath lomTaxonPath1 = new LOM_TaxonPath(); lomClassification1.Add_TaxonPath(lomTaxonPath1); lomTaxonPath1.Add_SourceName("ARIADNE"); LOM_Taxon lomTaxon1 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon1); lomTaxon1.ID = "BF120"; lomTaxon1.Add_Entry("Work_History", "en"); lomTaxon1.Add_Entry("Historie", "nl"); LOM_Taxon lomTaxon2 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon2); lomTaxon2.ID = "BF120.1"; lomTaxon2.Add_Entry("American Work_History", "en"); LOM_Taxon lomTaxon3 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon3); lomTaxon3.ID = "BF120.1.4"; lomTaxon3.Add_Entry("American Civil War", "en"); LOM_Classification lomClassification2 = new LOM_Classification(); lomInfo.Add_Classification(lomClassification2); lomClassification2.Purpose.Value = "Educational Objective"; LOM_TaxonPath lomTaxonPath2 = new LOM_TaxonPath(); lomClassification2.Add_TaxonPath(lomTaxonPath2); lomTaxonPath2.Add_SourceName("Common Core Standards", "en"); LOM_Taxon lomTaxon4 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon4); lomTaxon4.ID = "CCS.Math.Content"; LOM_Taxon lomTaxon5 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon5); lomTaxon5.ID = "3"; lomTaxon5.Add_Entry("Grade 3", "en"); LOM_Taxon lomTaxon6 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon6); lomTaxon6.ID = "OA"; lomTaxon6.Add_Entry("Operations and Algebraic Thinking", "en"); LOM_Taxon lomTaxon7 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon7); lomTaxon7.ID = "A"; lomTaxon7.Add_Entry("Represent and solve problems involving multiplication and division.", "en"); LOM_Taxon lomTaxon8 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon8); lomTaxon8.ID = "3"; lomTaxon8.Add_Entry("Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.", "en"); LOM_TaxonPath lomTaxonPath3 = new LOM_TaxonPath(); lomClassification2.Add_TaxonPath(lomTaxonPath3); lomTaxonPath3.Add_SourceName("Common Core Standards", "en"); LOM_Taxon lomTaxon14 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon14); lomTaxon14.ID = "CCS.Math.Content"; LOM_Taxon lomTaxon15 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon15); lomTaxon15.ID = "3"; lomTaxon15.Add_Entry("Grade 3", "en"); LOM_Taxon lomTaxon16 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon16); lomTaxon16.ID = "OA"; lomTaxon16.Add_Entry("Operations and Algebraic Thinking", "en"); LOM_Taxon lomTaxon17 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon17); lomTaxon17.ID = "A"; lomTaxon17.Add_Entry("Represent and solve problems involving multiplication and division.", "en"); LOM_Taxon lomTaxon18 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon18); lomTaxon18.ID = "4"; lomTaxon18.Add_Entry("Determine the unknown whole number in a multiplication or division equation relating three whole numbers. For example, determine the unknown number that makes the equation true in each of the equations 8 × ? = 48, 5 = _ ÷ 3, 6 × 6 = ?", "en"); // Add some views and interfaces testPackage.Behaviors.Clear_Web_Skins(); testPackage.Behaviors.Add_Web_Skin("dLOC"); testPackage.Behaviors.Add_Web_Skin("UFDC"); testPackage.Behaviors.Add_View(View_Enum.JPEG2000); testPackage.Behaviors.Add_View(View_Enum.JPEG); testPackage.Behaviors.Add_View(View_Enum.RELATED_IMAGES); testPackage.Behaviors.Add_View(View_Enum.HTML, "Full Document", "MVS001214.html"); // Create the chapters and pages and link them Division_TreeNode chapter1 = new Division_TreeNode("Chapter", "First Chapter"); Page_TreeNode page1 = new Page_TreeNode("First Page"); Page_TreeNode page2 = new Page_TreeNode("Page 2"); chapter1.Nodes.Add(page1); chapter1.Nodes.Add(page2); Division_TreeNode chapter2 = new Division_TreeNode("Chapter", "Last Chapter"); Page_TreeNode page3 = new Page_TreeNode("Page 3"); Page_TreeNode page4 = new Page_TreeNode("Last Page"); chapter2.Nodes.Add(page3); chapter2.Nodes.Add(page4); testPackage.Divisions.Physical_Tree.Roots.Add(chapter1); testPackage.Divisions.Physical_Tree.Roots.Add(chapter2); // Create the files SobekCM_File_Info file1_1 = new SobekCM_File_Info("2000626_0001.jp2", 2120, 1100); SobekCM_File_Info file1_2 = new SobekCM_File_Info("2000626_0001.jpg", 630, 330); SobekCM_File_Info file1_3 = new SobekCM_File_Info("2000626_0001.tif"); SobekCM_File_Info file2_1 = new SobekCM_File_Info("2000626_0002.jp2", 1754, 2453); SobekCM_File_Info file2_2 = new SobekCM_File_Info("2000626_0002.jpg", 630, 832); SobekCM_File_Info file2_3 = new SobekCM_File_Info("2000626_0002.tif"); SobekCM_File_Info file3_1 = new SobekCM_File_Info("2000626_0003.jp2", 2321, 1232); SobekCM_File_Info file3_2 = new SobekCM_File_Info("2000626_0003.jpg", 630, 342); SobekCM_File_Info file3_3 = new SobekCM_File_Info("2000626_0003.tif"); SobekCM_File_Info file4_1 = new SobekCM_File_Info("2000626_0004.jp2", 2145, 1024); SobekCM_File_Info file4_2 = new SobekCM_File_Info("2000626_0004.jpg", 630, 326); SobekCM_File_Info file4_3 = new SobekCM_File_Info("2000626_0004.tif"); // Link the files to the pages page1.Files.Add(file1_1); page1.Files.Add(file1_2); page1.Files.Add(file1_3); page2.Files.Add(file2_1); page2.Files.Add(file2_2); page2.Files.Add(file2_3); page3.Files.Add(file3_1); page3.Files.Add(file3_2); page3.Files.Add(file3_3); page4.Files.Add(file4_1); page4.Files.Add(file4_2); page4.Files.Add(file4_3); // Add the DAITSS information DAITSS_Info daitssInfo = new DAITSS_Info(); daitssInfo.Account = "FTU"; daitssInfo.SubAccount = "CLAS"; daitssInfo.Project = "UFDC"; daitssInfo.toArchive = true; testPackage.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); PALMM_Info palmmInfo = new PALMM_Info(); testPackage.Add_Metadata_Module("PALMM", palmmInfo); palmmInfo.toPALMM = false; // Save this package testPackage.Source_Directory = directory; return(testPackage); }
//new CSV Writer private bool Write_CSVFILE(System.IO.TextWriter CSVOutput, SobekCM_Item METS_Item, Dictionary <string, object> Options) { //2do confirm that this outputs a string of goodies ready to place in a CSV file // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { return(true); } string GMLSchemaURL = "http://www.opengis.net/gml"; //create header //2do: add custom schema string imageURL = "http://ufdc.ufl.edu/"; //create imageURL imageURL += METS_Item.BibID; imageURL += "/"; imageURL += METS_Item.VID; string featureCollectionURL = imageURL; //create collectionURL CSVOutput.WriteLine("BIBID, VID, Title, Date, ImageURL, Latitude1, Longitude1, Latitude2, Longitude2, Latitude3, Longitude3, Latitude4, Longitude4"); //output csv header //2do, make definable? //for points foreach (Coordinate_Point thisPoint in geoInfo.Points) { //iURL writer string csvImageURL = imageURL; CSVOutput.Write(METS_Item.BibID + ", " + METS_Item.VID + ", " + METS_Item.Bib_Title.Replace(",", " ") + ", " + METS_Item.Bib_Info.Origin_Info.Date_Issued + ", " + csvImageURL + ", "); CSVOutput.Write(thisPoint.Latitude + ", " + thisPoint.Longitude + ", "); CSVOutput.WriteLine(); //add line break } //for lines foreach (Coordinate_Line thisLine in geoInfo.Lines) { //URL writer string csvImageURL = imageURL; CSVOutput.Write(METS_Item.BibID + ", " + METS_Item.VID + ", " + METS_Item.Bib_Title.Replace(",", " ") + ", " + METS_Item.Bib_Info.Origin_Info.Date_Issued + ", " + csvImageURL + ", "); foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long { CSVOutput.Write(thisPoint.Latitude + ", " + thisPoint.Longitude + ", "); } CSVOutput.WriteLine(); //add line break } //for polygons foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates { //URL writer string csvImageURL = imageURL; if (geoInfo.Polygon_Count > 1) //this fixes bug where imageURL could be set to 0 { csvImageURL += "/"; csvImageURL += thisPolygon.Page_Sequence; } CSVOutput.Write(METS_Item.BibID + ", " + METS_Item.VID + ", " + METS_Item.Bib_Title.Replace(",", " ") + ", " + METS_Item.Bib_Info.Origin_Info.Date_Issued + ", " + csvImageURL + ", "); foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long { CSVOutput.Write(thisPoint.Latitude + ", " + thisPoint.Longitude + ", "); //csv } CSVOutput.WriteLine(); //add line break } return(true); }
/// <summary> Build the solr document from the SobekCM Digital Resource object </summary> /// <param name="Digital_Object"> Digital object to create an easily indexable view object for </param> /// <param name="File_Location"> Location for all of the text files associated with this item </param> /// <returns> Fully built (v5) solr document </returns> public v5_SolrDocument Build_Solr_Document(SobekCM_Item Digital_Object, string File_Location) { // Start the return object v5_SolrDocument returnValue = new v5_SolrDocument(); returnValue.FileLocation = File_Location; // Set the unique key returnValue.DID = Digital_Object.BibID + ":" + Digital_Object.VID; // Add the administrative fields returnValue.Aggregations = new List <string>(); returnValue.Aggregations.AddRange(Digital_Object.Behaviors.Aggregation_Code_List); returnValue.BibID = Digital_Object.BibID; returnValue.VID = Digital_Object.VID; returnValue.MainThumbnail = Digital_Object.Behaviors.Main_Thumbnail; // Add the made public field if (Digital_Object.Web.MadePublicDate.HasValue) { returnValue.MadePublicDate = Digital_Object.Web.MadePublicDate.Value; } else { // If this is public and non-dark, but no date for made // public exists, make it today if ((!Digital_Object.Behaviors.Dark_Flag) && (Digital_Object.Behaviors.IP_Restriction_Membership >= 0)) { Digital_Object.Web.MadePublicDate = DateTime.Now; } } // Add Serial hierarchy fields returnValue.Level1_Text = String.Empty; returnValue.Level1_Index = -1; returnValue.Level1_Facet = "NONE"; returnValue.Level2_Text = String.Empty; returnValue.Level2_Index = -1; returnValue.Level2_Facet = "NONE"; returnValue.Level3_Text = String.Empty; returnValue.Level3_Index = -1; returnValue.Level3_Facet = "NONE"; returnValue.Level4_Text = String.Empty; returnValue.Level4_Index = -1; returnValue.Level4_Facet = "NONE"; returnValue.Level5_Text = String.Empty; returnValue.Level5_Index = -1; returnValue.Level5_Facet = "NONE"; if (Digital_Object.Behaviors != null) { if (Digital_Object.Behaviors.Serial_Info.Count > 0) { returnValue.Level1_Index = Digital_Object.Behaviors.Serial_Info[0].Order; returnValue.Level1_Text = Digital_Object.Behaviors.Serial_Info[0].Display; returnValue.Level1_Text_Display = Digital_Object.Behaviors.Serial_Info[0].Display; returnValue.Level1_Facet = Digital_Object.Behaviors.Serial_Info[0].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[0].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 1) { returnValue.Level2_Index = Digital_Object.Behaviors.Serial_Info[1].Order; returnValue.Level2_Text = Digital_Object.Behaviors.Serial_Info[1].Display; returnValue.Level2_Text_Display = Digital_Object.Behaviors.Serial_Info[1].Display; returnValue.Level2_Facet = Digital_Object.Behaviors.Serial_Info[1].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[1].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 2) { returnValue.Level3_Index = Digital_Object.Behaviors.Serial_Info[2].Order; returnValue.Level3_Text = Digital_Object.Behaviors.Serial_Info[2].Display; returnValue.Level3_Text_Display = Digital_Object.Behaviors.Serial_Info[2].Display; returnValue.Level3_Facet = Digital_Object.Behaviors.Serial_Info[2].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[2].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 3) { returnValue.Level4_Index = Digital_Object.Behaviors.Serial_Info[3].Order; returnValue.Level4_Text = Digital_Object.Behaviors.Serial_Info[3].Display; returnValue.Level4_Text_Display = Digital_Object.Behaviors.Serial_Info[3].Display; returnValue.Level4_Facet = Digital_Object.Behaviors.Serial_Info[3].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[3].Display; } if (Digital_Object.Behaviors.Serial_Info.Count > 4) { returnValue.Level5_Index = Digital_Object.Behaviors.Serial_Info[4].Order; returnValue.Level5_Text = Digital_Object.Behaviors.Serial_Info[4].Display; returnValue.Level5_Text_Display = Digital_Object.Behaviors.Serial_Info[4].Display; returnValue.Level5_Facet = Digital_Object.Behaviors.Serial_Info[4].Order.ToString().PadLeft(5, '0') + '|' + Digital_Object.Behaviors.Serial_Info[4].Display; } returnValue.Hidden = Digital_Object.Behaviors.Dark_Flag; } // Some defaults returnValue.Discover_Groups = new List <int> { 0 }; returnValue.Discover_Users = new List <int> { 0 }; returnValue.RestrictedMsg = String.Empty; // Set the IP restrictions based on PRIVATE or NOT if (Digital_Object.Behaviors.IP_Restriction_Membership == -1) { returnValue.Discover_IPs = new List <int> { -1 } } ; else { returnValue.Discover_IPs = new List <int> { 0 }; // If some restrictions, set the restriction message if (Digital_Object.Behaviors.IP_Restriction_Membership > 0) { returnValue.RestrictedMsg = "Access Restrictions Apply"; } } // Set the spatial KML GeoSpatial_Information geo = Digital_Object.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geo != null) { if (returnValue.SpatialFootprintKml == null) { returnValue.SpatialFootprintKml = new List <string>(); } returnValue.SpatialFootprintKml.Add(geo.SobekCM_Main_Spatial_String); returnValue.SpatialDistance = (int)geo.SobekCM_Main_Spatial_Distance; } // Get the rest of the metadata, from the item List <KeyValuePair <string, string> > searchTerms = Digital_Object.Search_Terms; // Loop through and add each data field foreach (KeyValuePair <string, string> searchTerm in searchTerms) { // Ensure there is a value here if (String.IsNullOrWhiteSpace(searchTerm.Value)) { continue; } // Assign based on the key term switch (searchTerm.Key.ToLower()) { case "title": returnValue.Title = searchTerm.Value; break; case "sort title": returnValue.SortTitle = searchTerm.Value; break; case "other title": if (returnValue.AltTitle == null) { returnValue.AltTitle = new List <string>(); } returnValue.AltTitle.Add(searchTerm.Value); break; case "translated title": if (returnValue.TranslatedTitle == null) { returnValue.TranslatedTitle = new List <string>(); } returnValue.TranslatedTitle.Add(searchTerm.Value); break; case "series title": returnValue.SeriesTitle = searchTerm.Value; break; case "other citation": if (returnValue.OtherCitation == null) { returnValue.OtherCitation = new List <string>(); } returnValue.OtherCitation.Add(searchTerm.Value); break; case "tickler": if (returnValue.Tickler == null) { returnValue.Tickler = new List <string>(); } returnValue.Tickler.Add(searchTerm.Value); break; case "abstract": if (returnValue.Abstract == null) { returnValue.Abstract = new List <string>(); } returnValue.Abstract.Add(searchTerm.Value); break; case "affililation": if (returnValue.Affiliation == null) { returnValue.Affiliation = new List <string>(); } returnValue.Affiliation.Add(searchTerm.Value); // For now, also put this in the display if (returnValue.AffiliationDisplay == null) { returnValue.AffiliationDisplay = new List <string>(); } returnValue.AffiliationDisplay.Add(searchTerm.Value); break; case "affililation display": if (returnValue.AffiliationDisplay == null) { returnValue.AffiliationDisplay = new List <string>(); } returnValue.AffiliationDisplay.Add(searchTerm.Value); break; case "genre": if (returnValue.Genre == null) { returnValue.Genre = new List <string>(); } returnValue.Genre.Add(searchTerm.Value); break; case "genre display": if (returnValue.GenreDisplay == null) { returnValue.GenreDisplay = new List <string>(); } returnValue.GenreDisplay.Add(searchTerm.Value); break; case "donor": returnValue.Donor = searchTerm.Value; break; case "identifier": if (returnValue.Identifier == null) { returnValue.Identifier = new List <string>(); } returnValue.Identifier.Add(searchTerm.Value); break; case "identifier display": if (returnValue.IdentifierDisplay == null) { returnValue.IdentifierDisplay = new List <string>(); } returnValue.IdentifierDisplay.Add(searchTerm.Value); break; case "accession number": // Set the display value (also used for faceting) to the full term returnValue.AccessionNumberDisplay = searchTerm.Value; // Make sure the list is built if (returnValue.AccessionNumber == null) { returnValue.AccessionNumber = new List <string>(); } // If there are any periods, represeting a hierarchical identifier, split it if (searchTerm.Value.IndexOf(".") > 0) { // Add each segment of the identifier string[] split = searchTerm.Value.Split(".".ToCharArray()); StringBuilder builder = new StringBuilder(split[0]); returnValue.AccessionNumber.Add(builder.ToString()); for (int i = 1; i < split.Length; i++) { builder.Append("." + split[i]); returnValue.AccessionNumber.Add(builder.ToString()); } } else { returnValue.AccessionNumber.Add(searchTerm.Value); } break; case "language": if (returnValue.Language == null) { returnValue.Language = new List <string>(); } returnValue.Language.Add(searchTerm.Value); break; case "creator": if (returnValue.Creator == null) { returnValue.Creator = new List <string>(); } returnValue.Creator.Add(searchTerm.Value); break; case "creator.display": if (returnValue.Creator_Display == null) { returnValue.Creator_Display = new List <string>(); } returnValue.Creator_Display.Add(searchTerm.Value); break; case "publisher": if (returnValue.Publisher == null) { returnValue.Publisher = new List <string>(); } returnValue.Publisher.Add(searchTerm.Value); break; case "publisher.display": if (returnValue.Publisher_Display == null) { returnValue.Publisher_Display = new List <string>(); } returnValue.Publisher_Display.Add(searchTerm.Value); break; case "holding location": returnValue.Holding = searchTerm.Value; break; case "notes": if (returnValue.Notes == null) { returnValue.Notes = new List <string>(); } returnValue.Notes.Add(searchTerm.Value); break; case "frequency": if (returnValue.Frequency == null) { returnValue.Frequency = new List <string>(); } returnValue.Frequency.Add(searchTerm.Value); break; case "edition": returnValue.Edition = searchTerm.Value; break; case "publication place": if (returnValue.PubPlace == null) { returnValue.PubPlace = new List <string>(); } returnValue.PubPlace.Add(searchTerm.Value); break; case "format": returnValue.Format = searchTerm.Value; break; case "source institution": returnValue.Source = searchTerm.Value; break; case "target audience": if (returnValue.Audience == null) { returnValue.Audience = new List <string>(); } returnValue.Audience.Add(searchTerm.Value); break; case "type": returnValue.Type = searchTerm.Value; break; case "name as subject": if (returnValue.NameAsSubject == null) { returnValue.NameAsSubject = new List <string>(); } returnValue.NameAsSubject.Add(searchTerm.Value); break; case "name as subject dispay": if (returnValue.NameAsSubjectDisplay == null) { returnValue.NameAsSubjectDisplay = new List <string>(); } returnValue.NameAsSubjectDisplay.Add(searchTerm.Value); break; case "title as subject": if (returnValue.TitleAsSubject == null) { returnValue.TitleAsSubject = new List <string>(); } returnValue.TitleAsSubject.Add(searchTerm.Value); break; case "title as subject display": if (returnValue.TitleAsSubjectDisplay == null) { returnValue.TitleAsSubjectDisplay = new List <string>(); } returnValue.TitleAsSubjectDisplay.Add(searchTerm.Value); break; case "spatial coverage": if (returnValue.Spatial == null) { returnValue.Spatial = new List <string>(); } returnValue.Spatial.Add(searchTerm.Value); break; case "spatial coverage.display": if (returnValue.SpatialDisplay == null) { returnValue.SpatialDisplay = new List <string>(); } returnValue.SpatialDisplay.Add(searchTerm.Value); break; case "country": if (returnValue.Country == null) { returnValue.Country = new List <string>(); } returnValue.Country.Add(searchTerm.Value); break; case "state": if (returnValue.State == null) { returnValue.State = new List <string>(); } returnValue.State.Add(searchTerm.Value); break; case "county": if (returnValue.County == null) { returnValue.County = new List <string>(); } returnValue.County.Add(searchTerm.Value); break; case "city": if (returnValue.City == null) { returnValue.City = new List <string>(); } returnValue.City.Add(searchTerm.Value); break; case "subject keyword": if (returnValue.Subject == null) { returnValue.Subject = new List <string>(); } returnValue.Subject.Add(searchTerm.Value.Trim()); break; case "subjects.display": if (returnValue.SubjectDisplay == null) { returnValue.SubjectDisplay = new List <string>(); } returnValue.SubjectDisplay.Add(searchTerm.Value.Trim()); break; case "publication date": returnValue.Date = searchTerm.Value; returnValue.DateDisplay = searchTerm.Value; break; case "date year": returnValue.DateYear = searchTerm.Value; break; case "toc": if (returnValue.TableOfContents == null) { returnValue.TableOfContents = new List <string>(); } returnValue.TableOfContents.Add(searchTerm.Value.Trim()); break; case "mime type": if (returnValue.MimeType == null) { returnValue.MimeType = new List <string>(); } returnValue.MimeType.Add(searchTerm.Value.Trim()); break; case "cultural context": if (returnValue.CulturalContext == null) { returnValue.CulturalContext = new List <string>(); } returnValue.CulturalContext.Add(searchTerm.Value.Trim()); break; case "inscription": if (returnValue.Inscription == null) { returnValue.Inscription = new List <string>(); } returnValue.Inscription.Add(searchTerm.Value.Trim()); break; case "materials": case "material": if (returnValue.Material == null) { returnValue.Material = new List <string>(); } returnValue.Material.Add(searchTerm.Value.Trim()); break; case "materials display": case "material display": if (returnValue.MaterialDisplay == null) { returnValue.MaterialDisplay = new List <string>(); } returnValue.MaterialDisplay.Add(searchTerm.Value.Trim()); break; case "measurements": if (returnValue.Measurements == null) { returnValue.Measurements = new List <string>(); } returnValue.Measurements.Add(searchTerm.Value.Trim()); break; case "measurements display": if (returnValue.MeasurementsDisplay == null) { returnValue.MeasurementsDisplay = new List <string>(); } returnValue.MeasurementsDisplay.Add(searchTerm.Value.Trim()); break; case "style period": if (returnValue.StylePeriod == null) { returnValue.StylePeriod = new List <string>(); } returnValue.StylePeriod.Add(searchTerm.Value.Trim()); break; case "technique": if (returnValue.Technique == null) { returnValue.Technique = new List <string>(); } returnValue.Technique.Add(searchTerm.Value.Trim()); break; case "interviewee": if (returnValue.Interviewee == null) { returnValue.Interviewee = new List <string>(); } returnValue.Interviewee.Add(searchTerm.Value.Trim()); break; case "interviewer": if (returnValue.Interviewer == null) { returnValue.Interviewer = new List <string>(); } returnValue.Interviewer.Add(searchTerm.Value.Trim()); break; case "performance": returnValue.Performance = searchTerm.Value.Trim(); // For now, we aren't setting the performance display any differently than performance returnValue.PerformanceDisplay = searchTerm.Value.Trim(); break; case "performance date": returnValue.PerformanceDate = searchTerm.Value.Trim(); break; case "performer": if (returnValue.Performer == null) { returnValue.Performer = new List <string>(); } returnValue.Performer.Add(searchTerm.Value.Trim()); // For now, we aren't setting the performer display any differently than performer if (returnValue.PerformerDisplay == null) { returnValue.PerformerDisplay = new List <string>(); } returnValue.PerformerDisplay.Add(searchTerm.Value.Trim()); break; case "etd committee": if (returnValue.EtdCommittee == null) { returnValue.EtdCommittee = new List <string>(); } returnValue.EtdCommittee.Add(searchTerm.Value.Trim()); break; case "etd degree": returnValue.EtdDegree = searchTerm.Value.Trim(); break; case "etd degree discipline": returnValue.EtdDegreeDiscipline = searchTerm.Value.Trim(); break; case "etd degree division": returnValue.EtdDegreeDivision = searchTerm.Value.Trim(); break; case "etd degree grantor": returnValue.EtdDegreeGrantor = searchTerm.Value.Trim(); break; case "etd degree level": returnValue.EtdDegreeLevel = searchTerm.Value.Trim(); break; case "zt kingdom": if (returnValue.ZoologicalKingdom == null) { returnValue.ZoologicalKingdom = new List <string>(); } returnValue.ZoologicalKingdom.Add(searchTerm.Value.Trim()); break; case "zt phylum": if (returnValue.ZoologicalPhylum == null) { returnValue.ZoologicalPhylum = new List <string>(); } returnValue.ZoologicalPhylum.Add(searchTerm.Value.Trim()); break; case "zt class": if (returnValue.ZoologicalClass == null) { returnValue.ZoologicalClass = new List <string>(); } returnValue.ZoologicalClass.Add(searchTerm.Value.Trim()); break; case "zt order": if (returnValue.ZoologicalOrder == null) { returnValue.ZoologicalOrder = new List <string>(); } returnValue.ZoologicalOrder.Add(searchTerm.Value.Trim()); break; case "zt family": if (returnValue.ZoologicalFamily == null) { returnValue.ZoologicalFamily = new List <string>(); } returnValue.ZoologicalFamily.Add(searchTerm.Value.Trim()); break; case "zt genus": if (returnValue.ZoologicalGenus == null) { returnValue.ZoologicalGenus = new List <string>(); } returnValue.ZoologicalGenus.Add(searchTerm.Value.Trim()); break; case "zt species": if (returnValue.ZoologicalSpecies == null) { returnValue.ZoologicalSpecies = new List <string>(); } returnValue.ZoologicalSpecies.Add(searchTerm.Value.Trim()); break; case "zt common name": if (returnValue.ZoologicalCommonName == null) { returnValue.ZoologicalCommonName = new List <string>(); } returnValue.ZoologicalCommonName.Add(searchTerm.Value.Trim()); break; case "zt scientific name": if (returnValue.ZoologicalScientificName == null) { returnValue.ZoologicalScientificName = new List <string>(); } returnValue.ZoologicalScientificName.Add(searchTerm.Value.Trim()); break; case "zt hierarchical": if (returnValue.ZoologicalHierarchical == null) { returnValue.ZoologicalHierarchical = new List <string>(); } returnValue.ZoologicalHierarchical.Add(searchTerm.Value.Trim()); break; // Solr already rolls up to a zt_all field, so ignore this case "zt all taxonomy": break; case "lom aggregation": returnValue.LomAggregation = searchTerm.Value.Trim(); break; case "lom context": if (returnValue.LomContext == null) { returnValue.LomContext = new List <string>(); } returnValue.LomContext.Add(searchTerm.Value.Trim()); break; case "lom context display": if (returnValue.LomContextDisplay == null) { returnValue.LomContextDisplay = new List <string>(); } returnValue.LomContextDisplay.Add(searchTerm.Value.Trim()); break; case "lom difficulty": returnValue.LomDifficulty = searchTerm.Value.Trim(); break; case "lom intended end user": if (returnValue.LomIntendedEndUser == null) { returnValue.LomIntendedEndUser = new List <string>(); } returnValue.LomIntendedEndUser.Add(searchTerm.Value.Trim()); break; case "lom intended end user display": returnValue.LomIntendedEndUserDisplay = searchTerm.Value.Trim(); break; case "lom interactivity level": returnValue.LomInteractivityLevel = searchTerm.Value.Trim(); break; case "lom interactivity type": returnValue.LomInteractivityType = searchTerm.Value.Trim(); break; case "lom status": returnValue.LomStatus = searchTerm.Value.Trim(); break; case "lom requirement": if (returnValue.LomRequirement == null) { returnValue.LomRequirement = new List <string>(); } returnValue.LomRequirement.Add(searchTerm.Value.Trim()); break; case "lom requirement display": if (returnValue.LomRequirementDisplay == null) { returnValue.LomRequirementDisplay = new List <string>(); } returnValue.LomRequirementDisplay.Add(searchTerm.Value.Trim()); break; case "lom age range": if (returnValue.LomAgeRange == null) { returnValue.LomAgeRange = new List <string>(); } returnValue.LomAgeRange.Add(searchTerm.Value.Trim()); break; case "lom resource type": if (returnValue.LomResourceType == null) { returnValue.LomResourceType = new List <string>(); } returnValue.LomResourceType.Add(searchTerm.Value.Trim()); break; case "lom resource type display": if (returnValue.LomResourceTypeDisplay == null) { returnValue.LomResourceTypeDisplay = new List <string>(); } returnValue.LomResourceTypeDisplay.Add(searchTerm.Value.Trim()); break; case "lom learning time": returnValue.LomLearningTime = searchTerm.Value.Trim(); break; case "temporal subject": returnValue.TemporalSubject = searchTerm.Value.Trim(); break; case "temporal subject display": returnValue.TemporalSubjectDisplay = searchTerm.Value.Trim(); break; // Not handled yet case "temporal year": case "ead name": break; // Ignore these case "bibid": case "vid": break; // Some more to ignore, since these are handled differently in solr case "all subjects": case "aggregation": break; default: StreamWriter writer = new StreamWriter("missing_fields.txt", true); writer.WriteLine(searchTerm.Key); writer.Flush(); writer.Close(); break; } } // Find the Gregorian date issues value string pub_date = Digital_Object.Bib_Info.Origin_Info.Date_Check_All_Fields; returnValue.Date = pub_date; returnValue.DateDisplay = pub_date; DateTime gregDate; if (DateTime.TryParse(pub_date, out gregDate)) { returnValue.Date = returnValue.Date + " (Date Auto-Converted to " + gregDate.ToShortDateString() + ")"; returnValue.GregorianDate = gregDate; returnValue.DateYear = gregDate.Year.ToString(); // For now (since temporal subject isn't the best) just use this date for the timeline returnValue.TimelineDate = gregDate; returnValue.TimelineDateDisplay = pub_date; } else { int year_only; if ((pub_date.Length == 4) && (int.TryParse(pub_date, out year_only))) { gregDate = new DateTime(year_only, 1, 1); returnValue.Date = returnValue.Date = returnValue.Date + " (Date Converted to " + gregDate.ToShortDateString() + ")"; returnValue.GregorianDate = gregDate; returnValue.DateYear = gregDate.Year.ToString(); // For now (since temporal subject isn't the best) just use this date for the timeline returnValue.TimelineDate = gregDate; returnValue.TimelineDateDisplay = pub_date; } else { returnValue.Date = returnValue.Date + " (Date NOT Converted)"; } } //// Subject metadata fields ( and also same spatial information ) //List<string> spatials = new List<string>(); //List<Subject_Info_HierarchicalGeographic> hierarhicals = new List<Subject_Info_HierarchicalGeographic>(); //if ( Digital_Object.Bib_Info.Subjects_Count > 0 ) //{ // List<string> subjects = new List<string>(); // List<string> name_as_subject = new List<string>(); // List<string> title_as_subject = new List<string>(); // // Collect the types of subjects // foreach (Subject_Info thisSubject in Digital_Object.Bib_Info.Subjects) // { // switch (thisSubject.Class_Type) // { // case Subject_Info_Type.Name: // name_as_subject.Add(thisSubject.ToString()); // break; // case Subject_Info_Type.TitleInfo: // title_as_subject.Add(thisSubject.ToString()); // break; // case Subject_Info_Type.Standard: // subjects.Add(thisSubject.ToString()); // Subject_Info_Standard standardSubj = thisSubject as Subject_Info_Standard; // if (standardSubj.Geographics_Count > 0) // { // spatials.AddRange(standardSubj.Geographics); // } // break; // case Subject_Info_Type.Hierarchical_Spatial: // hierarhicals.Add( thisSubject as Subject_Info_HierarchicalGeographic); // break; // } // } // // Now add to this document, if present // if (name_as_subject.Count > 0) // { // NameAsSubject = new List<string>(); // NameAsSubject.AddRange(name_as_subject); // } // if (title_as_subject.Count > 0) // { // TitleAsSubject = new List<string>(); // TitleAsSubject.AddRange(title_as_subject); // } // if (subjects.Count > 0) // { // Subject = new List<string>(); // Subject.AddRange(subjects); // } //} // Add the empty solr pages for now returnValue.Solr_Pages = new List <Legacy_SolrPage>(); // Prepare to step through all the divisions/pages in this item int pageorder = 1; List <abstract_TreeNode> divsAndPages = Digital_Object.Divisions.Physical_Tree.Divisions_PreOrder; // Get the list of all TXT files in this division string[] text_files = Directory.GetFiles(File_Location, "*.txt"); Dictionary <string, string> text_files_existing = new Dictionary <string, string>(); foreach (string thisTextFile in text_files) { string filename = (new FileInfo(thisTextFile)).Name.ToUpper(); text_files_existing[filename] = filename; } // Get the list of all THM.JPG files in this division string[] thumbnail_files = Directory.GetFiles(File_Location, "*thm.jpg"); Dictionary <string, string> thumbnail_files_existing = new Dictionary <string, string>(); foreach (string thisTextFile in thumbnail_files) { string filename = (new FileInfo(thisTextFile)).Name; thumbnail_files_existing[filename.ToUpper().Replace("THM.JPG", "")] = filename; } // Step through all division nodes from the physical tree here List <string> text_files_included = new List <string>(); foreach (abstract_TreeNode thisNode in divsAndPages) { if (thisNode.Page) { // Cast to a page to continnue Page_TreeNode pageNode = (Page_TreeNode)thisNode; // Look for the root filename and then look for a matching TEXT file if (pageNode.Files.Count > 0) { string root = pageNode.Files[0].File_Name_Sans_Extension; if (text_files_existing.ContainsKey(root.ToUpper() + ".TXT")) { try { // SInce this is marked to be included, save this name text_files_included.Add(root.ToUpper() + ".TXT"); // Read the page text StreamReader reader = new StreamReader(File_Location + "\\" + root + ".txt"); string pageText = reader.ReadToEnd().Trim(); reader.Close(); // Look for a matching thumbnail string thumbnail = String.Empty; if (thumbnail_files_existing.ContainsKey(root.ToUpper())) { thumbnail = thumbnail_files_existing[root.ToUpper()]; } Legacy_SolrPage newPage = new Legacy_SolrPage(Digital_Object.BibID, Digital_Object.VID, pageorder, pageNode.Label, pageText, thumbnail); returnValue.Solr_Pages.Add(newPage); } catch { } } } // Increment the page order for the next page irregardless pageorder++; } } // Now, check for any other valid text files returnValue.AdditionalTextFiles = new List <string>(); foreach (string thisTextFile in text_files_existing.Keys) { if ((!text_files_included.Contains(thisTextFile.ToUpper())) && (thisTextFile.ToUpper() != "AGREEMENT.TXT") && (thisTextFile.ToUpper().IndexOf("REQUEST") != 0)) { returnValue.AdditionalTextFiles.Add(thisTextFile); } } return(returnValue); }
/// <summary> Method performs the actual search against the polygon/coordinates /// in the METS file for the current item </summary> protected void Perform_Coordinate_Search() { mapBuilder = new StringBuilder(); if (CurrentMode.ViewerCode == "mapsearch") { googleItemSearch = true; } // If coordinates were passed in, pull the actual coordinates out of the URL validCoordinateSearchFound = false; if (CurrentMode.Coordinates.Length > 0) { string[] splitter = CurrentMode.Coordinates.Split(",".ToCharArray()); if (((splitter.Length > 1) && (splitter.Length < 4)) || ((splitter.Length == 4) && (splitter[2].Length == 0) && (splitter[3].Length == 0))) { if ((Double.TryParse(splitter[0], out providedMaxLat)) && (Double.TryParse(splitter[1], out providedMaxLong))) { validCoordinateSearchFound = true; } providedMinLat = providedMaxLat; providedMinLong = providedMaxLong; } else if (splitter.Length >= 4) { if ((Double.TryParse(splitter[0], out providedMaxLat)) && (Double.TryParse(splitter[1], out providedMaxLong)) && (Double.TryParse(splitter[2], out providedMinLat)) && (Double.TryParse(splitter[3], out providedMinLong))) { validCoordinateSearchFound = true; } } } // Get the google map API mapBuilder.AppendLine("<script type=\"text/javascript\" src=\"http://maps.google.com/maps/api/js?sensor=false\"></script>"); mapBuilder.AppendLine("<script type=\"text/javascript\" src=\"" + CurrentMode.Base_URL + "default/scripts/sobekcm_map_search.js\"></script>"); mapBuilder.AppendLine("<script type=\"text/javascript\" src=\"" + CurrentMode.Base_URL + "default/scripts/sobekcm_map_tool.js\"></script>"); // Set some values for the map key string search_type = "geographic"; bool areas_shown = false; bool points_shown = false; string areas_name = "Sheet"; if (CurrentItem.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Aerial) { areas_name = "Tile"; } // Load the map mapBuilder.AppendLine("<script type=\"text/javascript\">"); mapBuilder.AppendLine(" //<![CDATA["); mapBuilder.AppendLine(" function load() {"); mapBuilder.AppendLine(googleItemSearch ? " load_search_map(6, 19.5, 3, \"map1\");" : " load_map(6, 19.5, 3, \"map1\");"); // Keep track of any matching tiles matchingTilesList = new List <string>(); // Add the points if (CurrentItem != null) { allPolygons = new List <Coordinate_Polygon>(); allPoints = new List <Coordinate_Point>(); allLines = new List <Coordinate_Line>(); // Add the search rectangle first if ((validCoordinateSearchFound) && (!googleItemSearch)) { if ((providedMaxLat != providedMinLat) || (providedMaxLong != providedMinLong)) { search_type = "rectangle"; mapBuilder.AppendLine(" add_rectangle(" + providedMaxLat + ", " + providedMaxLong + ", " + providedMinLat + ", " + providedMinLong + ");"); } else { search_type = "point"; } } // Build the matching polygon HTML to overlay the matches over the non-matches StringBuilder matchingPolygonsBuilder = new StringBuilder(); // Collect all the polygons, points, and lines GeoSpatial_Information geoInfo = CurrentItem.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo != null) && (geoInfo.hasData)) { if (geoInfo.Polygon_Count > 0) { foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) { allPolygons.Add(thisPolygon); } } if (geoInfo.Line_Count > 0) { foreach (Coordinate_Line thisLine in geoInfo.Lines) { allLines.Add(thisLine); } } if (geoInfo.Point_Count > 0) { foreach (Coordinate_Point thisPoint in geoInfo.Points) { allPoints.Add(thisPoint); } } } List <abstract_TreeNode> pages = CurrentItem.Divisions.Physical_Tree.Pages_PreOrder; for (int i = 0; i < pages.Count; i++) { abstract_TreeNode pageNode = pages[i]; GeoSpatial_Information geoInfo2 = pageNode.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo2 != null) && (geoInfo2.hasData)) { if (geoInfo2.Polygon_Count > 0) { foreach (Coordinate_Polygon thisPolygon in geoInfo2.Polygons) { thisPolygon.Page_Sequence = (ushort)(i + 1); allPolygons.Add(thisPolygon); } } if (geoInfo2.Line_Count > 0) { foreach (Coordinate_Line thisLine in geoInfo2.Lines) { allLines.Add(thisLine); } } if (geoInfo2.Point_Count > 0) { foreach (Coordinate_Point thisPoint in geoInfo2.Points) { allPoints.Add(thisPoint); } } } } // Add all the polygons now if ((allPolygons.Count > 0) && (allPolygons[0].Edge_Points_Count > 1)) { areas_shown = true; // Determine a base URL for pointing for any polygons that correspond to a page sequence string currentViewerCode = CurrentMode.ViewerCode; CurrentMode.ViewerCode = "XXXXXXXX"; string redirect_url = CurrentMode.Redirect_URL(); CurrentMode.ViewerCode = currentViewerCode; // Add each polygon foreach (Coordinate_Polygon itemPolygon in allPolygons) { // Determine if this polygon is within the search bool in_coordinates_search = false; if ((validCoordinateSearchFound) && (!googleItemSearch)) { // Was this a point search or area search? if ((providedMaxLong == providedMinLong) && (providedMaxLat == providedMinLat)) { // Check this point if (itemPolygon.is_In_Bounding_Box(providedMaxLat, providedMaxLong)) { in_coordinates_search = true; } } else { // Chieck this area search if (itemPolygon.is_In_Bounding_Box(providedMaxLat, providedMaxLong, providedMinLat, providedMinLong)) { in_coordinates_search = true; } } } // Look for a link for this item string link = String.Empty; if ((itemPolygon.Page_Sequence > 0) && (!googleItemSearch)) { link = redirect_url.Replace("XXXXXXXX", itemPolygon.Page_Sequence.ToString()); } // If this is an item search, don't show labels (too distracting) string label = itemPolygon.Label; if (googleItemSearch) { label = String.Empty; } if (in_coordinates_search) { // Start to call the add polygon method matchingPolygonsBuilder.AppendLine(" add_polygon(["); foreach (Coordinate_Point thisPoint in itemPolygon.Edge_Points) { matchingPolygonsBuilder.AppendLine(" new google.maps.LatLng(" + thisPoint.Latitude + ", " + thisPoint.Longitude + "),"); } matchingPolygonsBuilder.Append(" new google.maps.LatLng(" + itemPolygon.Edge_Points[0].Latitude + ", " + itemPolygon.Edge_Points[0].Longitude + ")],"); matchingPolygonsBuilder.AppendLine("true, '" + label + "', '" + link + "' );"); // Also add to the list of matching titles matchingTilesList.Add("<a href=\"" + link + "\">" + itemPolygon.Label + "</a>"); } else { // Start to call the add polygon method mapBuilder.AppendLine(" add_polygon(["); foreach (Coordinate_Point thisPoint in itemPolygon.Edge_Points) { mapBuilder.AppendLine(" new google.maps.LatLng(" + thisPoint.Latitude + ", " + thisPoint.Longitude + "),"); } mapBuilder.Append(" new google.maps.LatLng(" + itemPolygon.Edge_Points[0].Latitude + ", " + itemPolygon.Edge_Points[0].Longitude + ")],"); // If just one polygon, still show the red outline if (allPolygons.Count == 1) { mapBuilder.AppendLine("true, '', '" + link + "' );"); } else { mapBuilder.AppendLine("false, '" + label + "', '" + link + "' );"); } } } // Add any matching polygons last mapBuilder.Append(matchingPolygonsBuilder.ToString()); } // Draw all the single points if (allPoints.Count > 0) { points_shown = true; for (int point = 0; point < allPoints.Count; point++) { mapBuilder.AppendLine(" add_point(" + allPoints[point].Latitude + ", " + allPoints[point].Longitude + ", '" + allPoints[point].Label + "' );"); } } // If this was a point search, also add the point if (validCoordinateSearchFound) { if ((providedMaxLat == providedMinLat) && (providedMaxLong == providedMinLong)) { search_type = "point"; mapBuilder.AppendLine(" add_selection_point(" + providedMaxLat + ", " + providedMaxLong + ", 8 );"); } } // Add the searchable, draggable polygon last (if in search mode) if ((validCoordinateSearchFound) && (googleItemSearch)) { if ((providedMaxLat != providedMinLat) || (providedMaxLong != providedMinLong)) { mapBuilder.AppendLine(" add_selection_rectangle(" + providedMaxLat + ", " + providedMaxLong + ", " + providedMinLat + ", " + providedMinLong + " );"); } } // Add the map key if (!googleItemSearch) { mapBuilder.AppendLine(" add_key(" + search_type + ", " + areas_shown.ToString().ToLower() + ", " + points_shown.ToString().ToLower() + ", '" + areas_name + "');"); } // Zoom appropriately mapBuilder.AppendLine(matchingPolygonsBuilder.Length > 0 ? " zoom_to_selected();" : " zoom_to_bounds();"); } mapBuilder.AppendLine(" }"); mapBuilder.AppendLine(" //]]>"); mapBuilder.AppendLine("</script>"); }
/// <summary> Adds a bit of data to a bibliographic package using the mapping </summary> /// <param name="Package">Bibliographic package to receive the data</param> /// <param name="Data">Text of the data</param> /// <param name="Field">Mapped field</param> /// <returns> TRUE if the field was mapped, FALSE if there was data and no mapping was found </returns> public bool Add_Data(SobekCM_Item Package, string Data, string Field) { // If no field listed, just skip (but not a mapping error, so return TRUE) if (String.IsNullOrEmpty(Field)) { return(true); } // If no data listed, just skip (but not a mapping error, so return TRUE) if (String.IsNullOrWhiteSpace(Data)) { return(true); } // Trim the data Data = Data.Trim(); // Normalize the field name string correctName = Field.ToUpper().Replace("#", "").Replace(" ", "").Replace(".", "").Replace(":", "").Replace("\\", "").Replace("/", "").Replace(")", "").Replace("(", "").Trim(); if (correctName.Length == 0) { correctName = "None"; } else { // Find the first number int charIndex = 0; while ((charIndex < correctName.Length) && (!Char.IsNumber(correctName[charIndex]))) { charIndex++; } // If the index stopped before the end (that is, it found a number), // trim the number of the column name if ((charIndex < correctName.Length) && (charIndex > 0)) { correctName = correctName.Substring(0, charIndex); } // If it was all numbers, just assign NONE if (charIndex == 0) { correctName = "None"; } } // Everything depends on the field which is mapped switch (correctName) { case "NONE": // Do nothing, since no mapping exists return(true); case "ABSTRACT": case "SUMMARY": Package.Bib_Info.Add_Abstract(Data, "en"); return(true); case "ACCESSION": case "ACCESSIONNUMBER": Package.Bib_Info.Add_Identifier(Data, "Accession Number"); return(true); case "ALTERNATETITLE": case "ALTTITLE": case "TITLEVARIANT": Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Alternative); return(true); case "ALTERNATETITLELANGUAGE": case "ALTTITLELANGUAGE": List <Title_Info> otherTitles = Package.Bib_Info.Other_Titles.Where(ThisTitle => ThisTitle.Title_Type == Title_Type_Enum.Alternative).ToList(); if (otherTitles.Count > 0) { otherTitles[otherTitles.Count - 1].Language = Data; } return(true); case "TITLETRANSLATION": case "TRANSLATEDTITLE": Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Translated); return(true); case "ATTRIBUTION": Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Funding); return(true); case "COLLECTION": case "COLLECTIONCODE": case "AGGREGATION": case "AGGREGATIONCODE": case "SUBCOLLECTION": case "SUBCOLLECTIONS": Package.Behaviors.Add_Aggregation(Data.ToUpper()); return(true); case "CLASSIFICATION": Package.Bib_Info.Add_Classification(Data); return(true); case "CLASSIFICATIONTYPE": case "CLASSIFICATIONAUTHORITY": if (Package.Bib_Info.Classifications_Count > 0) { Package.Bib_Info.Classifications[Package.Bib_Info.Classifications_Count - 1].Authority = Data; } return(true); case "CONTRIBUTOR": case "CONTRIBUTORS": Package.Bib_Info.Add_Named_Entity(new Name_Info(Data, "contributor")); return(true); case "CREATOR": case "CREATORS": case "AUTHOR": // Ensure it doesn't already exist if (Package.Bib_Info.Names_Count > 0) { foreach (Name_Info thisName in Package.Bib_Info.Names) { if (String.Compare(thisName.Full_Name, Data, StringComparison.OrdinalIgnoreCase) == 0) { return(true); } } } Package.Bib_Info.Add_Named_Entity(new Name_Info(Data, "creator")); return(true); case "CREATORPERSONALNAME": // Ensure it doesn't already exist if (Package.Bib_Info.Names_Count > 0) { foreach (Name_Info thisName in Package.Bib_Info.Names) { if (String.Compare(thisName.Full_Name, Data, StringComparison.OrdinalIgnoreCase) == 0) { return(true); } } } Name_Info personalCreator = new Name_Info(Data, "creator"); personalCreator.Name_Type = Name_Info_Type_Enum.Personal; Package.Bib_Info.Add_Named_Entity(personalCreator); return(true); case "CREATORCORPORATENAME": Name_Info corporateCreator = new Name_Info(Data, "creator"); corporateCreator.Name_Type = Name_Info_Type_Enum.Corporate; Package.Bib_Info.Add_Named_Entity(corporateCreator); return(true); case "CREATORLANGUAGE": if (Package.Bib_Info.Names_Count > 0) { Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Description = Data; } return(true); case "CREATORAFFILIATION": case "AUTHORAFFILIATION": if (Package.Bib_Info.Names_Count > 0) { Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Affiliation = Data; } return(true); case "CREATORDATES": case "AUTHORDATES": if (Package.Bib_Info.Names_Count > 0) { Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Dates = Data; } return(true); case "CREATORFAMILYNAME": case "AUTHORFAMILYNAME": case "FAMILYNAME": if (Package.Bib_Info.Names_Count > 0) { Name_Info lastNamedEntity = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1]; if (lastNamedEntity.Family_Name.Length == 0) { lastNamedEntity.Family_Name = Data; } else { Name_Info newNameEntity = new Name_Info { Family_Name = Data }; Package.Bib_Info.Add_Named_Entity(newNameEntity); } } else { Name_Info newNameEntity = new Name_Info { Family_Name = Data }; Package.Bib_Info.Add_Named_Entity(newNameEntity); } return(true); case "CREATORGIVENNAME": case "AUTHORGIVENNAME": case "GIVENNAME": if (Package.Bib_Info.Names_Count > 0) { Name_Info lastNamedEntity = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1]; if (lastNamedEntity.Given_Name.Length == 0) { lastNamedEntity.Given_Name = Data; } else { Name_Info newNameEntity = new Name_Info { Given_Name = Data }; Package.Bib_Info.Add_Named_Entity(newNameEntity); } } else { Name_Info newNameEntity = new Name_Info { Given_Name = Data }; Package.Bib_Info.Add_Named_Entity(newNameEntity); } return(true); case "CREATORROLE": case "AUTHORROLE": case "CREATORROLES": case "AUTHORROLES": case "CREATORATTRIBUTION": if (Package.Bib_Info.Names_Count > 0) { Name_Info thisCreator = Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1]; if ((thisCreator.Roles.Count == 1) && ((thisCreator.Roles[0].Role == "creator") || (thisCreator.Roles[1].Role == "contributor"))) { thisCreator.Roles.Clear(); } Package.Bib_Info.Names[Package.Bib_Info.Names_Count - 1].Add_Role(Data); } return(true); case "CULTURALCONTEXT": case "CULTURE": VRACore_Info vraCoreInfo = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo == null) { vraCoreInfo = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo); } vraCoreInfo.Add_Cultural_Context(Data); return(true); case "DONOR": Package.Bib_Info.Donor.Full_Name = Data; return(true); case "GENRE": Package.Bib_Info.Add_Genre(Data); return(true); case "GENREAUTHORITY": if (Package.Bib_Info.Genres_Count > 0) { Package.Bib_Info.Genres[Package.Bib_Info.Genres_Count - 1].Authority = Data; } return(true); case "HOLDINGLOCATIONCODE": case "HOLDINGCODE": Package.Bib_Info.Location.Holding_Code = Data; return(true); case "HOLDINGLOCATIONSTATEMENT": case "HOLDINGSTATEMENT": case "CONTRIBUTINGINSTITUTION": case "LOCATIONCURRENT": case "LOCATIONCURRENTSITE": case "LOCATIONCURRENTREPOSITORY": Package.Bib_Info.Location.Holding_Name = Data; return(true); case "LOCATIONFORMERSITE": Package.Bib_Info.Add_Note(Data, Note_Type_Enum.OriginalLocation); return(true); case "IDENTIFIER": case "IDNUMBERFORMERREPOSITORY": case "IDNUMBERCURRENTREPOSITORY": case "IDNUMBERCURRENTRESPOSITORY": Package.Bib_Info.Add_Identifier(Data); return(true); case "IDENTIFIERTYPE": if (Package.Bib_Info.Identifiers_Count > 0) { Package.Bib_Info.Identifiers[Package.Bib_Info.Identifiers_Count - 1].Type = Data; } return(true); case "INSCRIPTION": VRACore_Info vraCoreInfo8 = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo8 == null) { vraCoreInfo8 = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo8); } vraCoreInfo8.Add_Inscription(Data); return(true); case "LANGUAGE": Package.Bib_Info.Add_Language(Data); return(true); case "PUBLISHER": case "PUBLISHERS": Package.Bib_Info.Add_Publisher(Data); return(true); case "PLACEOFPUBLICATION": case "PUBLICATIONPLACE": case "PUBPLACE": case "PUBLICATIONLOCATION": case "PLACE": Package.Bib_Info.Origin_Info.Add_Place(Data); return(true); case "RELATEDURLLABEL": Package.Bib_Info.Location.Other_URL_Display_Label = Data; return(true); case "RELATEDURL": case "RELATEDURLLINK": Package.Bib_Info.Location.Other_URL = Data; return(true); case "RELATEDURLNOTE": case "RELATEDURLNOTES": Package.Bib_Info.Location.Other_URL_Note = Data; return(true); case "SOURCEINSTITUTIONCODE": case "SOURCECODE": Package.Bib_Info.Source.Code = Data; return(true); case "SOURCEINSTITUTIONSTATEMENT": case "SOURCESTATEMENT": case "SOURCE": Package.Bib_Info.Source.Statement = Data; return(true); case "SUBJECTKEYWORD": case "SUBJECTKEYWORDS": case "SUBJECT": case "SUBJECTS": case "KEYWORDS": Package.Bib_Info.Add_Subject(Data, String.Empty); return(true); case "SUBJECTKEYWORDAUTHORITY": case "SUBJECTAUTHORITY": if (Package.Bib_Info.Subjects_Count > 0) { Package.Bib_Info.Subjects[Package.Bib_Info.Subjects_Count - 1].Authority = Data; } return(true); case "BIBID": case "BIB": case "BIBLIOGRAHPICID": case "BIBLIOGRAPHICIDENTIFIER": Package.Bib_Info.BibID = Data.ToUpper(); return(true); case "VID": Package.Bib_Info.VID = Data.PadLeft(5, '0'); return(true); case "DATE": case "DATECREATION": try { // first, try converting the string value to a date object Package.Bib_Info.Origin_Info.Date_Issued = Convert.ToDateTime(Data).ToShortDateString(); } catch { try { // second, try converting the string value to an integer Package.Bib_Info.Origin_Info.Date_Issued = Convert.ToInt32(Data).ToString(); } catch { Package.Bib_Info.Origin_Info.Date_Issued = Data; } } return(true); case "DATEBEGINNING": Package.Bib_Info.Origin_Info.MARC_DateIssued_Start = Data; return(true); case "DATECOMPLETION": Package.Bib_Info.Origin_Info.MARC_DateIssued_End = Data; return(true); case "EDITION": Package.Bib_Info.Origin_Info.Edition = Data; return(true); case "FORMAT": case "PHYSICALDESCRIPTION": case "EXTENT": Package.Bib_Info.Original_Description.Extent = Data; return(true); case "NOTE": case "NOTES": case "DESCRIPTION": Package.Bib_Info.Add_Note(Data); return(true); case "PROVENANCE": Package.Bib_Info.Add_Note(Data, Note_Type_Enum.Acquisition); return(true); case "USAGESTATEMENT": Package.Bib_Info.Add_Note(Data, Note_Type_Enum.CitationReference); return(true); case "CONTACT": case "CONTACTNOTES": case "CONTACTINFORMATION": Package.Bib_Info.Add_Note(Data, Note_Type_Enum.NONE, "Contact"); return(true); case "RIGHTS": Package.Bib_Info.Access_Condition.Text = Data; return(true); case "BIBSERIESTITLE": case "SERIESTITLE": case "TITLESERIES": Package.Bib_Info.SeriesTitle.Title = Data; Package.Behaviors.GroupTitle = Data; return(true); case "MATERIALTYPE": case "TYPE": case "RECORDTYPE": string upper_data = Data.ToUpper(); if (upper_data.IndexOf("NEWSPAPER", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper; return(true); } if ((upper_data.IndexOf("MONOGRAPH", StringComparison.Ordinal) >= 0) || (upper_data.IndexOf("BOOK", StringComparison.Ordinal) >= 0)) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book; return(true); } if (upper_data.IndexOf("SERIAL", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial; return(true); } if (upper_data.IndexOf("AERIAL", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Aerial; if (Package.Bib_Info.Original_Description.Extent.Length == 0) { Package.Bib_Info.Original_Description.Extent = "Aerial Photograph"; } return(true); } if (upper_data.IndexOf("PHOTO", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph; return(true); } if (upper_data.IndexOf("POSTCARD", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph; if (Package.Bib_Info.Original_Description.Extent.Length == 0) { Package.Bib_Info.Original_Description.Extent = "Postcard"; } return(true); } if (upper_data.IndexOf("MAP", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Map; return(true); } if (upper_data.IndexOf("TEXT", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book; return(true); } if (upper_data.IndexOf("AUDIO", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Audio; return(true); } if (upper_data.IndexOf("VIDEO", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Video; return(true); } if ((upper_data.IndexOf("ARCHIVE", StringComparison.Ordinal) >= 0) || (upper_data.IndexOf("ARCHIVAL", StringComparison.Ordinal) >= 0)) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival; return(true); } if (upper_data.IndexOf("ARTIFACT", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Artifact; return(true); } if (upper_data.IndexOf("IMAGE", StringComparison.Ordinal) >= 0) { Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph; return(true); } // if there was no match, set type to "UNDETERMINED" Package.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.UNKNOWN; if (Package.Bib_Info.Original_Description.Extent.Length == 0) { Package.Bib_Info.Original_Description.Extent = "Undetermined"; } return(true); case "BIBUNIFORMTITLE": case "UNIFORMTITLE": Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Uniform); Package.Behaviors.GroupTitle = Data; return(true); case "VOLUMETITLE": case "TITLE": if (String.IsNullOrEmpty(Package.Bib_Info.Main_Title.Title)) { Package.Bib_Info.Main_Title.Title = Data; } else { Package.Bib_Info.Add_Other_Title(Data, Title_Type_Enum.Alternative); } return(true); case "TITLELANGUAGE": Package.Bib_Info.Main_Title.Language = Data; return(true); case "ALEPH": Package.Bib_Info.Add_Identifier(Data, "ALEPH"); return(true); case "OCLC": Package.Bib_Info.Add_Identifier(Data, "OCLC"); return(true); case "LCCN": Package.Bib_Info.Add_Identifier(Data, "LCCN"); return(true); case "ISBN": Package.Bib_Info.Add_Identifier(Data, "ISBN"); return(true); case "ISSN": Package.Bib_Info.Add_Identifier(Data, "ISSN"); return(true); case "SUBTITLE": Package.Bib_Info.Main_Title.Subtitle = Data; return(true); case "VOLUME": Package.Bib_Info.Series_Part_Info.Enum1 = Data; Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data); return(true); case "ISSUE": if (Package.Bib_Info.Series_Part_Info.Enum1.Length == 0) { Package.Bib_Info.Series_Part_Info.Enum1 = Data; } else { Package.Bib_Info.Series_Part_Info.Enum2 = Data; } Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data); return(true); case "SECTION": if (Package.Bib_Info.Series_Part_Info.Enum2.Length == 0) { if (Package.Bib_Info.Series_Part_Info.Enum1.Length == 0) { Package.Bib_Info.Series_Part_Info.Enum1 = Data; } else { Package.Bib_Info.Series_Part_Info.Enum2 = Data; } } else { Package.Bib_Info.Series_Part_Info.Enum3 = Data; } Package.Behaviors.Serial_Info.Add_Hierarchy(Package.Behaviors.Serial_Info.Count + 1, 1, Data); // Do nothing for now return(true); case "YEAR": Package.Bib_Info.Series_Part_Info.Year = Data; if (Data.Length == 1) { year = "0" + Data; } else { year = Data; } build_date_string(Package); return(true); case "MONTH": Package.Bib_Info.Series_Part_Info.Month = Data; month = Data; build_date_string(Package); return(true); case "DAY": Package.Bib_Info.Series_Part_Info.Day = Data; day = Data; build_date_string(Package); return(true); case "COORDINATES": GeoSpatial_Information geoInfo = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { geoInfo = new GeoSpatial_Information(); Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo); } string[] coordinates = Data.Split(", ;".ToCharArray()); try { if (coordinates.Length == 2) { geoInfo.Add_Point(Convert.ToDouble(coordinates[0]), Convert.ToDouble(coordinates[1]), String.Empty); } else { coordinates = Data.Split(",;".ToCharArray()); if (coordinates.Length == 2) { geoInfo.Add_Point(Convert.ToDouble(coordinates[0]), Convert.ToDouble(coordinates[1]), String.Empty); } } } catch { } return(true); case "LATITUDE": case "COORDINATESLATITUDE": GeoSpatial_Information geoInfo2 = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo2 == null) { geoInfo2 = new GeoSpatial_Information(); Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo2); } try { if (geoInfo2.Point_Count == 0) { geoInfo2.Add_Point(Convert.ToDouble(Data), 0, String.Empty); } else { geoInfo2.Points[0].Latitude = Convert.ToDouble(Data); } } catch { } return(true); case "LONGITUDE": case "COORDINATESLONGITUDE": GeoSpatial_Information geoInfo3 = Package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo3 == null) { geoInfo3 = new GeoSpatial_Information(); Package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo3); } try { if (geoInfo3.Point_Count == 0) { geoInfo3.Add_Point(0, Convert.ToDouble(Data.Replace("°", "")), String.Empty); } else { geoInfo3.Points[0].Longitude = Convert.ToDouble(Data.Replace("°", "")); } } catch { } return(true); case "PROJECTION": case "MAPPROJECTION": Guarantee_Cartographics(Package).Projection = Data; return(true); case "SCALE": case "MAPSCALE": Guarantee_Cartographics(Package).Scale = Data; return(true); //case Mapped_Fields.Spatial_Coverage: // Package.Bib_Info.Hierarchical_Spatials[0].Area = Data; // return true; case "ICON/WORDMARK": case "ICON/WORDMARKS": case "ICON": case "ICONS": case "WORDMARK": case "WORDMARKS": Package.Behaviors.Add_Wordmark(Data); return(true); case "WEBSKINS": case "WEBSKIN": case "SKINS": case "SKIN": Package.Behaviors.Add_Web_Skin(Data); return(true); case "TEMPORALCOVERAGE": case "TEMPORAL": case "TIMEPERIOD": Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data); return(true); case "COVERAGE": // Was this a number.. likely, a year? int possible_year; if ((Data.Length >= 4) && (Int32.TryParse(Data.Substring(0, 4), out possible_year))) { Package.Bib_Info.Add_Temporal_Subject(-1, -1, Data); } else { Package.Bib_Info.Add_Spatial_Subject(Data); } return(true); case "AFFILIATIONUNIVERSITY": case "UNIVERSITY": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].University = Data; return(true); case "AFFILIATIONCAMPUS": case "CAMPUS": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].Campus = Data; return(true); case "AFFILIATIONCOLLEGE": case "COLLEGE": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].College = Data; return(true); case "AFFILIATIONUNIT": case "UNIT": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].Unit = Data; return(true); case "AFFILIATIONDEPARTMENT": case "DEPARTMENT": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].Department = Data; return(true); case "AFFILIATIONINSTITUTE": case "INSTITUTE": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].Institute = Data; return(true); case "AFFILIATIONCENTER": case "CENTER": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].Center = Data; return(true); case "AFFILIATIONSECTION": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].Section = Data; return(true); case "AFFILIATIONSUBSECTION": Guarantee_Affiliation_Collection(Package); Package.Bib_Info.Affiliations[0].SubSection = Data; return(true); case "GEOGRAPHYCONTINENT": case "CONTINENT": Guarantee_Hierarchical_Spatial(Package).Continent = Data; return(true); case "GEOGRAPHYCOUNTRY": case "COUNTRY": Guarantee_Hierarchical_Spatial(Package).Country = Data; return(true); case "GEOGRAPHYPROVINCE": case "PROVINCE": Guarantee_Hierarchical_Spatial(Package).Province = Data; return(true); case "GEOGRAPHYREGION": case "REGION": Guarantee_Hierarchical_Spatial(Package).Region = Data; return(true); case "GEOGRAPHYSTATE": case "STATE": Guarantee_Hierarchical_Spatial(Package).State = Data; return(true); case "GEOGRAPHYTERRITORY": case "TERRITORY": Guarantee_Hierarchical_Spatial(Package).Territory = Data; return(true); case "GEOGRAPHYCOUNTY": case "COUNTY": Guarantee_Hierarchical_Spatial(Package).County = Data; return(true); case "GEOGRAPHYCITY": case "CITY": Guarantee_Hierarchical_Spatial(Package).City = Data; return(true); case "GEOGRAPHYISLAND": case "ISLAND": Guarantee_Hierarchical_Spatial(Package).Island = Data; return(true); case "GEOGRAPHYAREA": case "AREA": Guarantee_Hierarchical_Spatial(Package).Area = Data; return(true); case "LOCATION": Package.Bib_Info.Add_Spatial_Subject(Data); return(true); case "COPYRIGHTDATE": case "COPYRIGHT": Package.Bib_Info.Origin_Info.Date_Copyrighted = Data; return(true); case "EADNAME": case "EAD": Package.Bib_Info.Location.EAD_Name = Data; return(true); case "EADURL": Package.Bib_Info.Location.EAD_URL = Data; return(true); case "COMMENTS": case "INTERNALCOMMENTS": case "INTERNAL": Package.Tracking.Internal_Comments = Data; return(true); case "CONTAINERBOX": case "BOX": Package.Bib_Info.Add_Container("Box", Data, 1); return(true); case "CONTAINERDIVIDER": case "DIVIDER": Package.Bib_Info.Add_Container("Divider", Data, 2); return(true); case "CONTAINERFOLDER": case "FOLDER": Package.Bib_Info.Add_Container("Folder", Data, 3); return(true); case "VIEWERS": case "VIEWER": Package.Behaviors.Add_View(Data); return(true); case "VISIBILITY": switch (Data.ToUpper()) { case "DARK": Package.Behaviors.Dark_Flag = true; Package.Behaviors.IP_Restriction_Membership = -1; return(true); case "PRIVATE": Package.Behaviors.Dark_Flag = false; Package.Behaviors.IP_Restriction_Membership = -1; return(true); case "PUBLIC": Package.Behaviors.Dark_Flag = false; Package.Behaviors.IP_Restriction_Membership = 0; return(true); case "RESTRICTED": Package.Behaviors.Dark_Flag = false; Package.Behaviors.IP_Restriction_Membership = 1; return(true); } return(true); case "TICKLER": Package.Behaviors.Add_Tickler(Data); return(true); case "TRACKINGBOX": Package.Tracking.Tracking_Box = Data; return(true); case "BORNDIGITAL": if (Data.ToUpper().Trim() == "TRUE") { Package.Tracking.Born_Digital = true; } return(true); case "MATERIALRECEIVED": case "MATERIALRECEIVEDDATE": case "MATERIALRECDDATE": case "MATERIALRECD": DateTime materialReceivedDate; if (DateTime.TryParse(Data, out materialReceivedDate)) { Package.Tracking.Material_Received_Date = materialReceivedDate; } return(true); case "MATERIAL": case "MATERIALS": case "MATERIALMEDIUM": VRACore_Info vraCoreInfo2 = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo2 == null) { vraCoreInfo2 = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo2); } vraCoreInfo2.Add_Material(Data, "medium"); return(true); case "MATERIALSUPPORT": VRACore_Info vraCoreInfo2b = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo2b == null) { vraCoreInfo2b = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo2b); } vraCoreInfo2b.Add_Material(Data, "support"); return(true); case "MEASUREMENT": case "MEASUREMENTS": case "MEASUREMENTDIMENSIONS": case "MEASUREMENTSDIMENSIONS": case "DIMENSIONS": VRACore_Info vraCoreInfo3 = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo3 == null) { vraCoreInfo3 = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo3); } if (vraCoreInfo3.Measurement_Count == 0) { vraCoreInfo3.Add_Measurement(Data, String.Empty); } else { vraCoreInfo3.Measurements[0].Measurements = Data; } return(true); case "MEASUREMENTFORMAT": case "MEASUREMENTUNITS": case "MEASUREMENTSFORMAT": case "MEASUREMENTSUNITS": VRACore_Info vraCoreInfo3b = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo3b == null) { vraCoreInfo3b = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo3b); } if (vraCoreInfo3b.Measurement_Count == 0) { vraCoreInfo3b.Add_Measurement(String.Empty, Data); } else { vraCoreInfo3b.Measurements[0].Units = Data; } return(true); case "STATEEDITION": VRACore_Info vraCoreInfo4 = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo4 == null) { vraCoreInfo4 = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo4); } vraCoreInfo4.Add_State_Edition(Data); return(true); case "STYLE": case "PERIOD": case "STYLEPERIOD": VRACore_Info vraCoreInfo5 = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo5 == null) { vraCoreInfo5 = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo5); } vraCoreInfo5.Add_Style_Period(Data); return(true); case "TECHNIQUE": VRACore_Info vraCoreInfo6 = Package.Get_Metadata_Module("VRACore") as VRACore_Info; if (vraCoreInfo6 == null) { vraCoreInfo6 = new VRACore_Info(); Package.Add_Metadata_Module("VRACore", vraCoreInfo6); } vraCoreInfo6.Add_Technique(Data); return(true); case "TARGETAUDIENCE": case "AUDIENCE": Package.Bib_Info.Add_Target_Audience(Data); return(true); default: // No mapping exists and this is a non-known no-mapping return(false); } }
//new KML Writer public bool Write_KMLFile(String KMLOutputPathName, SobekCM_Item METS_Item) { StreamWriter KMLOutput = new StreamWriter(KMLOutputPathName, false); // GEt the geo-spatial information if it exists GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module("GeoSpatial") as GeoSpatial_Information; if (geoInfo == null) { return(true); } Coordinates thisCoordinates = geoInfo.Coords; //put mets coordinates into object string imageURL = "http://ufdc.ufl.edu/"; //create imageURL imageURL += METS_Item.BibID; imageURL += "/"; imageURL += METS_Item.VID; string featureCollectionURL = imageURL; //create collectionURL KMLOutput.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); KMLOutput.WriteLine("<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gml=\"http://www.opengis.net/gml\">"); KMLOutput.WriteLine("<Document>"); KMLOutput.WriteLine("<Folder>"); KMLOutput.WriteLine("<name>" + featureCollectionURL + "</name>"); //write collectionURL as name //for points foreach (Coordinate_Point thisPoint in thisCoordinates.Points) { KMLOutput.WriteLine("<Placemark>"); KMLOutput.WriteLine("<Metadata>"); KMLOutput.WriteLine("<gml:FeatureCollection>"); KMLOutput.WriteLine("<gml:featureMember>"); if (thisPoint.Label.Length > 0) { KMLOutput.WriteLine("<gml:Point label=\"" + thisPoint.Label + "\">"); } else { KMLOutput.WriteLine("<gml:Point>"); } KMLOutput.WriteLine("<gml:Coordinates>" + thisPoint.Latitude + "," + thisPoint.Longitude + "</gml:Coordinates>"); KMLOutput.WriteLine("</gml:Point>"); KMLOutput.WriteLine("</gml:featureMember>"); KMLOutput.WriteLine("</gml:FeatureCollection>"); KMLOutput.WriteLine("</Metadata>"); if (thisPoint.Label.Length > 0) { KMLOutput.WriteLine("<name>" + thisPoint.Label + "</name>"); } else { KMLOutput.WriteLine("<name></name>"); } KMLOutput.WriteLine("<description></description>"); KMLOutput.WriteLine("<Point>"); KMLOutput.WriteLine("<coordinates>" + thisPoint.Longitude + "," + thisPoint.Latitude + ",0</coordinates>"); KMLOutput.WriteLine("</Point>"); KMLOutput.WriteLine("</Placemark>"); } //for lines foreach (Coordinate_Line thisLine in thisCoordinates.Lines) { KMLOutput.WriteLine("<Placemark>"); KMLOutput.WriteLine("<Metadata>"); KMLOutput.WriteLine("<gml:FeatureCollection>"); KMLOutput.WriteLine("<gml:featureMember>"); if (thisLine.Label.Length > 0) { KMLOutput.WriteLine("<gml:Line label=\"" + thisLine.Label + "\">"); } else { KMLOutput.WriteLine("<gml:Line>"); } KMLOutput.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long { KMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } KMLOutput.Write("</gml:Coordinates>"); KMLOutput.WriteLine(); KMLOutput.WriteLine("</gml:Line>"); KMLOutput.WriteLine("</gml:featureMember>"); KMLOutput.WriteLine("</gml:FeatureCollection>"); KMLOutput.WriteLine("</Metadata>"); if (thisLine.Label.Length > 0) { KMLOutput.WriteLine("<name>" + thisLine.Label + "</name>"); } else { KMLOutput.WriteLine("<name></name>"); } KMLOutput.WriteLine("<description></description>"); KMLOutput.WriteLine("<LineString>"); KMLOutput.WriteLine("<extrude>1</extrude>"); KMLOutput.WriteLine("<tessellate>1</tessellate>"); KMLOutput.WriteLine("<altitudeMode>absolute</altitudeMode>"); KMLOutput.Write("<coordinates>"); foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long { KMLOutput.Write(thisPoint.Longitude + "," + thisPoint.Latitude + ",0 "); } KMLOutput.WriteLine("</coordinates>"); KMLOutput.WriteLine("</LineString>"); KMLOutput.WriteLine("</Placemark>"); } //for polygons foreach (Coordinate_Polygon thisPolygon in thisCoordinates.Polygons) //for each polygon with coordinates { string featureMemberURL = imageURL; featureMemberURL += "/"; featureMemberURL += thisPolygon.Page_Sequence; KMLOutput.WriteLine("<Placemark>"); KMLOutput.WriteLine("<Metadata>"); KMLOutput.WriteLine("<gml:FeatureCollection>"); KMLOutput.WriteLine("<gml:featureMember>"); if (thisPolygon.Label.Length > 0) { KMLOutput.WriteLine("<gml:Polygon label=\"" + thisPolygon.Label + "\">"); } else { KMLOutput.WriteLine("<gml:Polygon>"); } KMLOutput.Write("<gml:Coordinates>"); foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long { KMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); } KMLOutput.WriteLine("</gml:Coordinates>"); KMLOutput.WriteLine("</gml:Polygon>"); KMLOutput.WriteLine("</gml:featureMember>"); KMLOutput.WriteLine("</gml:FeatureCollection>"); KMLOutput.WriteLine("</Metadata>"); if (thisPolygon.Label.Length > 0) { KMLOutput.WriteLine("<name>" + thisPolygon.Label + "</name>"); } else { KMLOutput.WriteLine("<name></name>"); } KMLOutput.WriteLine("<description>" + featureMemberURL + "</description>"); KMLOutput.WriteLine("<Polygon>"); KMLOutput.WriteLine("<extrude>1</extrude>"); KMLOutput.WriteLine("<altitudeMode>relativeToGround</altitudeMode>"); KMLOutput.WriteLine("<outerBoundaryIs>"); KMLOutput.WriteLine("<LinearRing>"); KMLOutput.WriteLine("<coordinates>"); foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points) //for each lat/long { KMLOutput.Write(thisPoint.Longitude + "," + thisPoint.Latitude + ",0 "); } KMLOutput.WriteLine("</coordinates>"); KMLOutput.WriteLine("</LinearRing>"); KMLOutput.WriteLine("</outerBoundaryIs>"); KMLOutput.WriteLine("</Polygon>"); KMLOutput.WriteLine("</Placemark>"); } KMLOutput.WriteLine("</Folder>"); KMLOutput.WriteLine("</Document>"); KMLOutput.WriteLine("</kml>"); KMLOutput.Flush(); KMLOutput.Close(); return(true); }
private void Finish_Building_Item(SobekCM_Item thisPackage, DataSet databaseInfo, bool multiple) { // Copy over some basic values DataRow mainItemRow = databaseInfo.Tables[2].Rows[0]; thisPackage.Behaviors.Set_Primary_Identifier(mainItemRow["Primary_Identifier_Type"].ToString(), mainItemRow["Primary_Identifier"].ToString()); thisPackage.Behaviors.GroupTitle = mainItemRow["GroupTitle"].ToString(); thisPackage.Web.File_Root = mainItemRow["File_Location"].ToString(); thisPackage.Web.AssocFilePath = mainItemRow["File_Location"] + "\\" + thisPackage.VID + "\\"; thisPackage.Behaviors.IP_Restriction_Membership = Convert.ToInt16(mainItemRow["IP_Restriction_Mask"]); thisPackage.Behaviors.CheckOut_Required = Convert.ToBoolean(mainItemRow["CheckoutRequired"]); thisPackage.Behaviors.Text_Searchable = Convert.ToBoolean(mainItemRow["TextSearchable"]); thisPackage.Web.ItemID = Convert.ToInt32(mainItemRow["ItemID"]); thisPackage.Web.GroupID = Convert.ToInt32(mainItemRow["GroupID"]); thisPackage.Behaviors.Suppress_Endeca = Convert.ToBoolean(mainItemRow["SuppressEndeca"]); //thisPackage.Behaviors.Expose_Full_Text_For_Harvesting = Convert.ToBoolean(mainItemRow["SuppressEndeca"]); thisPackage.Tracking.Internal_Comments = mainItemRow["Comments"].ToString(); thisPackage.Behaviors.Dark_Flag = Convert.ToBoolean(mainItemRow["Dark"]); thisPackage.Tracking.Born_Digital = Convert.ToBoolean(mainItemRow["Born_Digital"]); //thisPackage.Divisions.Page_Count = Convert.ToInt32(mainItemRow["Pages"]); if (mainItemRow["Disposition_Advice"] != DBNull.Value) { thisPackage.Tracking.Disposition_Advice = Convert.ToInt16(mainItemRow["Disposition_Advice"]); } else { thisPackage.Tracking.Disposition_Advice = -1; } if (mainItemRow["Material_Received_Date"] != DBNull.Value) { thisPackage.Tracking.Material_Received_Date = Convert.ToDateTime(mainItemRow["Material_Received_Date"]); } else { thisPackage.Tracking.Material_Received_Date = null; } if (mainItemRow["Material_Recd_Date_Estimated"] != DBNull.Value) { thisPackage.Tracking.Material_Rec_Date_Estimated = Convert.ToBoolean(mainItemRow["Material_Recd_Date_Estimated"]); } if (databaseInfo.Tables[2].Columns.Contains("Tracking_Box")) { if (mainItemRow["Tracking_Box"] != DBNull.Value) { thisPackage.Tracking.Tracking_Box = mainItemRow["Tracking_Box"].ToString(); } } // Set more of the sobekcm web portions in the item thisPackage.Web.Set_BibID_VID(thisPackage.BibID, thisPackage.VID); thisPackage.Web.Image_Root = SobekCM_Library_Settings.Image_URL; if (multiple) { thisPackage.Web.Siblings = 2; } // Set the serial hierarchy from the database (if multiple) if ((multiple) && (mainItemRow["Level1_Text"].ToString().Length > 0)) { bool found = false; // Get the values from the database first string level1_text = mainItemRow["Level1_Text"].ToString(); string level2_text = mainItemRow["Level2_Text"].ToString(); string level3_text = mainItemRow["Level3_Text"].ToString(); int level1_index = Convert.ToInt32(mainItemRow["Level1_Index"]); int level2_index = Convert.ToInt32(mainItemRow["Level2_Index"]); int level3_index = Convert.ToInt32(mainItemRow["Level3_Index"]); // Does this match the enumeration if (level1_text.ToUpper().Trim() == thisPackage.Bib_Info.Series_Part_Info.Enum1.ToUpper().Trim()) { // Copy the database values to the enumeration portion thisPackage.Bib_Info.Series_Part_Info.Enum1 = level1_text; thisPackage.Bib_Info.Series_Part_Info.Enum1_Index = level1_index; thisPackage.Bib_Info.Series_Part_Info.Enum2 = level2_text; thisPackage.Bib_Info.Series_Part_Info.Enum2_Index = level2_index; thisPackage.Bib_Info.Series_Part_Info.Enum3 = level3_text; thisPackage.Bib_Info.Series_Part_Info.Enum3_Index = level3_index; found = true; } // Does this match the chronology if ((!found) && (level1_text.ToUpper().Trim() == thisPackage.Bib_Info.Series_Part_Info.Year.ToUpper().Trim())) { // Copy the database values to the chronology portion thisPackage.Bib_Info.Series_Part_Info.Year = level1_text; thisPackage.Bib_Info.Series_Part_Info.Year_Index = level1_index; thisPackage.Bib_Info.Series_Part_Info.Month = level2_text; thisPackage.Bib_Info.Series_Part_Info.Month_Index = level2_index; thisPackage.Bib_Info.Series_Part_Info.Day = level3_text; thisPackage.Bib_Info.Series_Part_Info.Day_Index = level3_index; found = true; } if (!found) { // No match. If it is numeric, move it to the chronology, otherwise, enumeration bool charFound = level1_text.Trim().Any(thisChar => !Char.IsNumber(thisChar)); if (charFound) { // Copy the database values to the enumeration portion thisPackage.Bib_Info.Series_Part_Info.Enum1 = level1_text; thisPackage.Bib_Info.Series_Part_Info.Enum1_Index = level1_index; thisPackage.Bib_Info.Series_Part_Info.Enum2 = level2_text; thisPackage.Bib_Info.Series_Part_Info.Enum2_Index = level2_index; thisPackage.Bib_Info.Series_Part_Info.Enum3 = level3_text; thisPackage.Bib_Info.Series_Part_Info.Enum3_Index = level3_index; } else { // Copy the database values to the chronology portion thisPackage.Bib_Info.Series_Part_Info.Year = level1_text; thisPackage.Bib_Info.Series_Part_Info.Year_Index = level1_index; thisPackage.Bib_Info.Series_Part_Info.Month = level2_text; thisPackage.Bib_Info.Series_Part_Info.Month_Index = level2_index; thisPackage.Bib_Info.Series_Part_Info.Day = level3_text; thisPackage.Bib_Info.Series_Part_Info.Day_Index = level3_index; } } // Copy the database values to the simple serial portion (used to actually determine serial heirarchy) thisPackage.Behaviors.Serial_Info.Clear(); thisPackage.Behaviors.Serial_Info.Add_Hierarchy(1, level1_index, level1_text); if (level2_text.Length > 0) { thisPackage.Behaviors.Serial_Info.Add_Hierarchy(2, level2_index, level2_text); if (level3_text.Length > 0) { thisPackage.Behaviors.Serial_Info.Add_Hierarchy(3, level3_index, level3_text); } } } // See if this can be described bool can_describe = false; foreach (DataRow thisRow in databaseInfo.Tables[1].Rows) { int thisAggregationValue = Convert.ToInt16(thisRow["Items_Can_Be_Described"]); if (thisAggregationValue == 0) { can_describe = false; break; } if (thisAggregationValue == 2) { can_describe = true; } } thisPackage.Behaviors.Can_Be_Described = can_describe; // Look for user descriptions foreach (DataRow thisRow in databaseInfo.Tables[0].Rows) { string first_name = thisRow["FirstName"].ToString(); string nick_name = thisRow["NickName"].ToString(); string last_name = thisRow["LastName"].ToString(); int userid = Convert.ToInt32(thisRow["UserID"]); string tag = thisRow["Description_Tag"].ToString(); int tagid = Convert.ToInt32(thisRow["TagID"]); DateTime dateAdded = Convert.ToDateTime(thisRow["Date_Modified"]); if (nick_name.Length > 0) { thisPackage.Behaviors.Add_User_Tag(userid, nick_name + " " + last_name, tag, dateAdded, tagid); } else { thisPackage.Behaviors.Add_User_Tag(userid, first_name + " " + last_name, tag, dateAdded, tagid); } } // Look for ticklers foreach (DataRow thisRow in databaseInfo.Tables[3].Rows) { thisPackage.Behaviors.Add_Tickler(thisRow["MetadataValue"].ToString().Trim()); } // Set the aggregations in the package to the aggregation links from the database thisPackage.Behaviors.Clear_Aggregations(); foreach (DataRow thisRow in databaseInfo.Tables[1].Rows) { if (!Convert.ToBoolean(thisRow["impliedLink"])) { thisPackage.Behaviors.Add_Aggregation(thisRow["Code"].ToString()); } } // If no collections, add some regardless of whether it was IMPLIED if (thisPackage.Behaviors.Aggregation_Count == 0) { foreach (DataRow thisRow in databaseInfo.Tables[1].Rows) { if (thisRow["Type"].ToString().ToUpper() == "COLLECTION") { thisPackage.Behaviors.Add_Aggregation(thisRow["Code"].ToString()); } } } // Step through each page and set the static page count pageseq = 0; List <Page_TreeNode> pages_encountered = new List <Page_TreeNode>(); foreach (abstract_TreeNode rootNode in thisPackage.Divisions.Physical_Tree.Roots) { recurse_through_nodes(thisPackage, rootNode, pages_encountered); } thisPackage.Web.Static_PageCount = pages_encountered.Count; thisPackage.Web.Static_Division_Count = divseq; // Make sure no icons were retained from the METS file itself thisPackage.Behaviors.Clear_Wordmarks(); // Add the icons from the database information foreach (DataRow iconRow in databaseInfo.Tables[5].Rows) { string image = iconRow[0].ToString(); string link = iconRow[1].ToString().Replace("&", "&").Replace("\"", """); string code = iconRow[2].ToString(); string name = code.Replace("&", "&").Replace("\"", """); string html; if (link.Length == 0) { html = "<img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" title=\"" + name + "\" alt=\"" + name + "\" />"; } else { if (link[0] == '?') { html = "<a href=\"" + link + "\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" title=\"" + name + "\" alt=\"" + name + "\" /></a>"; } else { html = "<a href=\"" + link + "\" target=\"_blank\"><img class=\"SobekItemWordmark\" src=\"<%BASEURL%>design/wordmarks/" + image + "\" title=\"" + name + "\" alt=\"" + name + "\" /></a>"; } } Wordmark_Info newIcon = new Wordmark_Info { HTML = html, Link = link, Title = name, Code = code }; thisPackage.Behaviors.Add_Wordmark(newIcon); } // Make sure no web skins were retained from the METS file itself thisPackage.Behaviors.Clear_Web_Skins(); // Add the web skins from the database foreach (DataRow skinRow in databaseInfo.Tables[6].Rows) { thisPackage.Behaviors.Add_Web_Skin(skinRow[0].ToString().ToUpper()); } // Make sure no views were retained from the METS file itself thisPackage.Behaviors.Clear_Views(); // If this has more than 1 sibling (this count includes itself), add the multi-volumes viewer if (multiple) { thisPackage.Behaviors.Add_View(View_Enum.ALL_VOLUMES, String.Empty, thisPackage.Bib_Info.SobekCM_Type_String); } // Add the full citation view and the (hidden) tracking view thisPackage.Behaviors.Add_View(View_Enum.CITATION); thisPackage.Behaviors.Add_View(View_Enum.TRACKING); // Add the full text if (thisPackage.Behaviors.Text_Searchable) { thisPackage.Behaviors.Add_View(View_Enum.SEARCH); } // Is there an embedded video? if (thisPackage.Behaviors.Embedded_Video.Length > 0) { thisPackage.Behaviors.Add_View(View_Enum.EMBEDDED_VIDEO); } // If there is no PURL, add one based on how SobekCM operates if (thisPackage.Bib_Info.Location.PURL.Length == 0) { thisPackage.Bib_Info.Location.PURL = SobekCM_Library_Settings.System_Base_URL + thisPackage.BibID + "/" + thisPackage.VID; } // IF this is dark, add no other views if (!thisPackage.Behaviors.Dark_Flag) { // Check to see which views were present from the database, and build the list Dictionary <View_Enum, View_Object> viewsFromDb = new Dictionary <View_Enum, View_Object>(); foreach (DataRow viewRow in databaseInfo.Tables[4].Rows) { string viewType = viewRow[0].ToString(); string attribute = viewRow[1].ToString(); string label = viewRow[2].ToString(); View_Enum viewTypeEnum = View_Enum.None; switch (viewType) { case "JPEG": viewTypeEnum = View_Enum.JPEG; break; case "JPEG2000": viewTypeEnum = View_Enum.JPEG2000; break; case "Text": viewTypeEnum = View_Enum.TEXT; break; case "Page Turner": viewTypeEnum = View_Enum.PAGE_TURNER; break; case "Google Map": viewTypeEnum = View_Enum.GOOGLE_MAP; break; case "HTML Viewer": viewTypeEnum = View_Enum.HTML; break; case "HTML Map Viewer": viewTypeEnum = View_Enum.HTML_MAP; break; case "Related Images": viewTypeEnum = View_Enum.RELATED_IMAGES; break; case "TOC": viewTypeEnum = View_Enum.TOC; break; case "TEI": viewTypeEnum = View_Enum.TEI; break; } if (viewTypeEnum != View_Enum.None) { viewsFromDb[viewTypeEnum] = new View_Object(viewTypeEnum, label, attribute); } } // Add the thumbnail view, if requested and has multiple pages if (thisPackage.Divisions.Page_Count > 1) { if (viewsFromDb.ContainsKey(View_Enum.RELATED_IMAGES)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.RELATED_IMAGES]); viewsFromDb.Remove(View_Enum.RELATED_IMAGES); } thisPackage.Behaviors.Add_View(View_Enum.QUALITY_CONTROL); } else { if (viewsFromDb.ContainsKey(View_Enum.RELATED_IMAGES)) { viewsFromDb.Remove(View_Enum.RELATED_IMAGES); } } // If this item has more than one division, look for the TOC viewer if ((thisPackage.Divisions.Has_Multiple_Divisions) && (!thisPackage.Bib_Info.ImageClass)) { if (viewsFromDb.ContainsKey(View_Enum.TOC)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.TOC]); viewsFromDb.Remove(View_Enum.TOC); } } // In addition, if there is a latitude or longitude listed, look for the Google Maps bool hasCoords = false; GeoSpatial_Information geoInfo = (GeoSpatial_Information)thisPackage.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY); if ((geoInfo != null) && (geoInfo.hasData)) { if ((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0)) { hasCoords = true; } } if (!hasCoords) { List <abstract_TreeNode> pageList = thisPackage.Divisions.Physical_Tree.Pages_PreOrder; foreach (abstract_TreeNode thisPage in pageList) { GeoSpatial_Information geoInfo2 = (GeoSpatial_Information)thisPage.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY); if ((geoInfo2 != null) && (geoInfo2.hasData)) { if ((geoInfo2.Point_Count > 0) || (geoInfo2.Polygon_Count > 0)) { hasCoords = true; break; } } } } if (hasCoords) { if (viewsFromDb.ContainsKey(View_Enum.GOOGLE_MAP)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.GOOGLE_MAP]); viewsFromDb.Remove(View_Enum.GOOGLE_MAP); } else { thisPackage.Behaviors.Add_View(View_Enum.GOOGLE_MAP); } } // Step through each download and make sure it is fully built if (thisPackage.Divisions.Download_Tree.Has_Files) { string ead_file = String.Empty; int pdf_download = 0; string pdf_download_url = String.Empty; int non_flash_downloads = 0; List <abstract_TreeNode> downloadPages = thisPackage.Divisions.Download_Tree.Pages_PreOrder; foreach (Page_TreeNode downloadPage in downloadPages) { // Was this an EAD page? if ((downloadPage.Label == GlobalVar.EAD_METADATA_MODULE_KEY) && (downloadPage.Files.Count == 1)) { ead_file = downloadPage.Files[0].System_Name; } // Was this an XSL/EAD page? if ((downloadPage.Label == "XSL") && (downloadPage.Files.Count == 1)) { } // Step through each download file foreach (SobekCM_File_Info thisFile in downloadPage.Files) { if (thisFile.File_Extension == "SWF") { string flashlabel = downloadPage.Label; View_Object newView = thisPackage.Behaviors.Add_View(View_Enum.FLASH, flashlabel, String.Empty, thisFile.System_Name); thisPackage.Behaviors.Default_View = newView; } else { non_flash_downloads++; } if (thisFile.File_Extension == "PDF") { pdf_download++; pdf_download_url = thisFile.System_Name; } } } if (((non_flash_downloads > 0) && (pdf_download != 1)) || ((non_flash_downloads > 1) && (pdf_download == 1))) { if (thisPackage.Web.Static_PageCount == 0) { thisPackage.Behaviors.Default_View = thisPackage.Behaviors.Add_View(View_Enum.DOWNLOADS); } else { thisPackage.Behaviors.Add_View(View_Enum.DOWNLOADS); } } if (pdf_download == 1) { if ((thisPackage.Web.Static_PageCount == 0) && (thisPackage.Behaviors.Default_View == null)) { thisPackage.Behaviors.Default_View = thisPackage.Behaviors.Add_View(View_Enum.PDF); thisPackage.Behaviors.Default_View.FileName = pdf_download_url; } else { thisPackage.Behaviors.Add_View(View_Enum.PDF).FileName = pdf_download_url; } } // Some special code for EAD objects if ((thisPackage.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Archival) && (ead_file.Length > 0)) { // Now, read this EAD file information string ead_file_location = SobekCM_Library_Settings.Image_Server_Network + thisPackage.Web.AssocFilePath + ead_file; EAD_File_ReaderWriter reader = new EAD_File_ReaderWriter(); string Error_Message; Dictionary <string, object> options = new Dictionary <string, object>(); options["EAD_File_ReaderWriter:XSL_Location"] = SobekCM_Library_Settings.System_Base_URL + "default/sobekcm_default.xsl"; reader.Read_Metadata(ead_file_location, thisPackage, options, out Error_Message); // Clear all existing views thisPackage.Behaviors.Clear_Views(); thisPackage.Behaviors.Add_View(View_Enum.CITATION); thisPackage.Behaviors.Default_View = thisPackage.Behaviors.Add_View(View_Enum.EAD_DESCRIPTION); // Get the metadata module for EADs EAD_Info eadInfo = (EAD_Info)thisPackage.Get_Metadata_Module(GlobalVar.EAD_METADATA_MODULE_KEY); if ((eadInfo != null) && (eadInfo.Container_Hierarchy.Containers.Count > 0)) { thisPackage.Behaviors.Add_View(View_Enum.EAD_CONTAINER_LIST); } } } else { if (thisPackage.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Aerial) { thisPackage.Behaviors.Add_View(View_Enum.DOWNLOADS); } } // If there is a RELATED URL with youtube, add that viewer if ((thisPackage.Bib_Info.hasLocationInformation) && (thisPackage.Bib_Info.Location.Other_URL.ToLower().IndexOf("www.youtube.com") >= 0)) { View_Object newViewObj = new View_Object(View_Enum.YOUTUBE_VIDEO); thisPackage.Behaviors.Add_View(newViewObj); thisPackage.Behaviors.Default_View = newViewObj; } // Look for the HTML type views next, and possible set some defaults if (viewsFromDb.ContainsKey(View_Enum.HTML)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.HTML]); thisPackage.Behaviors.Default_View = viewsFromDb[View_Enum.HTML]; viewsFromDb.Remove(View_Enum.HTML); } // Look for the HTML MAP type views next, and possible set some defaults if (viewsFromDb.ContainsKey(View_Enum.HTML_MAP)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.HTML_MAP]); thisPackage.Behaviors.Default_View = viewsFromDb[View_Enum.HTML_MAP]; viewsFromDb.Remove(View_Enum.HTML_MAP); } // Copy the TEI flag if (viewsFromDb.ContainsKey(View_Enum.TEI)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.TEI]); viewsFromDb.Remove(View_Enum.HTML); } // Look to add any index information here ( such as on SANBORN maps) Map_Info mapInfo = (Map_Info)thisPackage.Get_Metadata_Module(GlobalVar.SOBEKCM_MAPS_METADATA_MODULE_KEY); if (mapInfo != null) { // Was there a HTML map here? if (mapInfo.Index_Count > 0) { Map_Index thisIndex = mapInfo.Get_Index(0); View_Object newMapSanbView = thisPackage.Behaviors.Add_View(View_Enum.HTML_MAP, thisIndex.Title, thisIndex.Image_File + ";" + thisIndex.HTML_File); thisPackage.Behaviors.Default_View = newMapSanbView; } //// Were there streets? //if (thisPackage.Map.Streets.Count > 0) //{ // returnValue.Item_Views.Add(new ViewerFetcher.Streets_ViewerFetcher()); //} //// Were there features? //if (thisPackage.Map.Features.Count > 0) //{ // returnValue.Item_Views.Add(new ViewerFetcher.Features_ViewerFetcher()); //} } // Look for the RELATED IMAGES view next if (viewsFromDb.ContainsKey(View_Enum.RELATED_IMAGES)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.RELATED_IMAGES]); viewsFromDb.Remove(View_Enum.RELATED_IMAGES); } // Look for the PAGE TURNER view next if (viewsFromDb.ContainsKey(View_Enum.PAGE_TURNER)) { thisPackage.Behaviors.Add_View(viewsFromDb[View_Enum.PAGE_TURNER]); viewsFromDb.Remove(View_Enum.PAGE_TURNER); } // Finally, add all the ITEM VIEWS foreach (View_Object thisObject in viewsFromDb.Values) { switch (thisObject.View_Type) { case View_Enum.TEXT: case View_Enum.JPEG: case View_Enum.JPEG2000: thisPackage.Behaviors.Add_Item_Level_Page_View(thisObject); break; } } } }
/// <summary> Map one or more data elements from the original METS-based object to the /// BriefItem object </summary> /// <param name="Original"> Original METS-based object </param> /// <param name="New"> New object to populate some data from the original </param> /// <returns> TRUE if successful, FALSE if an exception is encountered </returns> public bool MapToBriefItem(SobekCM_Item Original, BriefItemInfo New) { // Attempt to pull the top-level geo-spatial data from the source object GeoSpatial_Information geoInfo = Original.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; // If there was geo-spatial data here, add it to the new item if ((geoInfo != null) && (geoInfo.hasData) && ((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0))) { // Ensure the brief item has a geospatial object if (New.GeoSpatial == null) { New.GeoSpatial = new BriefItem_GeoSpatial(); } // Add each point first into the description ReadOnlyCollection <Coordinate_Point> origPoints = geoInfo.Points; foreach (Coordinate_Point thisPoint in origPoints) { if (!String.IsNullOrEmpty(thisPoint.Label)) { New.Add_Description("Coordinates", thisPoint.Latitude + " x " + thisPoint.Longitude + " ( " + thisPoint.Label + " )"); } else { New.Add_Description("Coordinates", thisPoint.Latitude + " x " + thisPoint.Longitude); } // Also add each point into the object itself if (New.GeoSpatial.Points == null) { New.GeoSpatial.Points = new List <BriefItem_Coordinate_Point>(); } // Create the new point BriefItem_Coordinate_Point cPoint = new BriefItem_Coordinate_Point { Latitude = thisPoint.Latitude, Longitude = thisPoint.Longitude, Altitude = thisPoint.Altitude, Label = thisPoint.Label, FeatureType = thisPoint.FeatureType }; // Add it New.GeoSpatial.Points.Add(cPoint); } // Add the polygons to the description, if there is only one. if (geoInfo.Polygon_Count == 1) { for (int i = 0; i < geoInfo.Polygon_Count; i++) { Coordinate_Polygon polygon = geoInfo.Get_Polygon(i); StringBuilder polygonBuilder = new StringBuilder(); foreach (Coordinate_Point thisPoint in polygon.Edge_Points) { if (polygonBuilder.Length > 0) { polygonBuilder.Append(", " + thisPoint.Latitude + " x " + thisPoint.Longitude); } else { polygonBuilder.Append(thisPoint.Latitude + " x " + thisPoint.Longitude); } } if (polygon.Label.Length > 0) { polygonBuilder.Append(" ( " + polygon.Label + " )"); } if (polygonBuilder.ToString().Trim().Length > 0) { New.Add_Description("Polygon", polygonBuilder.ToString()); } } } // Map each polygon over now as well if (geoInfo.Polygon_Count > 0) { // Ensure the polygon collection is defined if (New.GeoSpatial.Polygons == null) { New.GeoSpatial.Polygons = new List <BriefItem_Coordinate_Polygon>(); } // Get the collection of polygons and step through them ReadOnlyCollection <Coordinate_Polygon> origPolys = geoInfo.Polygons; foreach (Coordinate_Polygon thisPoly in origPolys) { // Start to build the new poly BriefItem_Coordinate_Polygon cPoly = new BriefItem_Coordinate_Polygon { Label = thisPoly.Label, FeatureType = thisPoly.FeatureType, Page_Sequence = thisPoly.Page_Sequence, Rotation = thisPoly.Rotation, PolygonType = thisPoly.PolygonType }; // Copy over all the vertices if (thisPoly.Edge_Points_Count > 0) { // Ensure the edge points collection is defined if (cPoly.Edge_Points == null) { cPoly.Edge_Points = new List <BriefItem_Coordinate_Point>(); } // Copy over all the vertices ReadOnlyCollection <Coordinate_Point> origVertices = thisPoly.Edge_Points; foreach (Coordinate_Point thisPoint in origVertices) { // Create the new point BriefItem_Coordinate_Point cPoint = new BriefItem_Coordinate_Point { Latitude = thisPoint.Latitude, Longitude = thisPoint.Longitude, Altitude = thisPoint.Altitude, Label = thisPoint.Label, FeatureType = thisPoint.FeatureType }; // Add it cPoly.Edge_Points.Add(cPoint); } } // Add this poly New.GeoSpatial.Polygons.Add(cPoly); } } // Map each line over now as well if (geoInfo.Line_Count > 0) { // Ensure the line collection is defined if (New.GeoSpatial.Lines == null) { New.GeoSpatial.Lines = new List <BriefItem_Coordinate_Line>(); } // Get the collection of lines and step through them ReadOnlyCollection <Coordinate_Line> origLines = geoInfo.Lines; foreach (Coordinate_Line thisLine in origLines) { // Start to build the new line BriefItem_Coordinate_Line cLine = new BriefItem_Coordinate_Line { Label = thisLine.Label, FeatureType = thisLine.FeatureType }; // Copy over all the vertices if (thisLine.Point_Count > 0) { // Ensure the points collection is defined if (cLine.Points == null) { cLine.Points = new List <BriefItem_Coordinate_Point>(); } // Copy over all the vertices ReadOnlyCollection <Coordinate_Point> origVertices = thisLine.Points; foreach (Coordinate_Point thisPoint in origVertices) { // Create the new point BriefItem_Coordinate_Point cPoint = new BriefItem_Coordinate_Point { Latitude = thisPoint.Latitude, Longitude = thisPoint.Longitude, Altitude = thisPoint.Altitude, Label = thisPoint.Label, FeatureType = thisPoint.FeatureType }; // Add it cLine.Points.Add(cPoint); } } // Add this poly New.GeoSpatial.Lines.Add(cLine); } } } // Now, copy over all the geo-spatial information at the page level List <abstract_TreeNode> pages = Original.Divisions.Physical_Tree.Pages_PreOrder; for (int i = 0; i < pages.Count; i++) { abstract_TreeNode pageNode = pages[i]; GeoSpatial_Information geoInfo2 = pageNode.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if ((geoInfo2 != null) && (geoInfo2.hasData)) { // Since some data was found, make sure the geospatial object exists // Ensure the brief item has a geospatial object if (New.GeoSpatial == null) { New.GeoSpatial = new BriefItem_GeoSpatial(); } // Any polygons exist at this page level? if (geoInfo2.Polygon_Count > 0) { foreach (Coordinate_Polygon thisPolygon in geoInfo2.Polygons) { thisPolygon.Page_Sequence = (ushort)(i + 1); // Ensure the polygon collection is defined if (New.GeoSpatial.Polygons == null) { New.GeoSpatial.Polygons = new List <BriefItem_Coordinate_Polygon>(); } // Get the collection of polygons and step through them ReadOnlyCollection <Coordinate_Polygon> origPolys = geoInfo2.Polygons; foreach (Coordinate_Polygon thisPoly in origPolys) { // Start to build the new poly BriefItem_Coordinate_Polygon cPoly = new BriefItem_Coordinate_Polygon { Label = thisPoly.Label, FeatureType = thisPoly.FeatureType, Page_Sequence = thisPoly.Page_Sequence, Rotation = thisPoly.Rotation, PolygonType = thisPoly.PolygonType }; // Copy over all the vertices if (thisPoly.Edge_Points_Count > 0) { // Ensure the edge points collection is defined if (cPoly.Edge_Points == null) { cPoly.Edge_Points = new List <BriefItem_Coordinate_Point>(); } // Copy over all the vertices ReadOnlyCollection <Coordinate_Point> origVertices = thisPoly.Edge_Points; foreach (Coordinate_Point thisPoint in origVertices) { // Create the new point BriefItem_Coordinate_Point cPoint = new BriefItem_Coordinate_Point { Latitude = thisPoint.Latitude, Longitude = thisPoint.Longitude, Altitude = thisPoint.Altitude, Label = thisPoint.Label, FeatureType = thisPoint.FeatureType }; // Add it cPoly.Edge_Points.Add(cPoint); } } // Add this poly New.GeoSpatial.Polygons.Add(cPoly); } } } if (geoInfo2.Line_Count > 0) { // Ensure the line collection is defined if (New.GeoSpatial.Lines == null) { New.GeoSpatial.Lines = new List <BriefItem_Coordinate_Line>(); } // Add each line foreach (Coordinate_Line thisLine in geoInfo2.Lines) { // Start to build the new line BriefItem_Coordinate_Line cLine = new BriefItem_Coordinate_Line { Label = thisLine.Label, FeatureType = thisLine.FeatureType }; // Copy over all the vertices if (thisLine.Point_Count > 0) { // Ensure the points collection is defined if (cLine.Points == null) { cLine.Points = new List <BriefItem_Coordinate_Point>(); } // Copy over all the vertices ReadOnlyCollection <Coordinate_Point> origVertices = thisLine.Points; foreach (Coordinate_Point thisPoint in origVertices) { // Create the new point BriefItem_Coordinate_Point cPoint = new BriefItem_Coordinate_Point { Latitude = thisPoint.Latitude, Longitude = thisPoint.Longitude, Altitude = thisPoint.Altitude, Label = thisPoint.Label, FeatureType = thisPoint.FeatureType }; // Add it cLine.Points.Add(cPoint); } } // Add this poly New.GeoSpatial.Lines.Add(cLine); } } if (geoInfo2.Point_Count > 0) { // Ensure the points collection was defined if (New.GeoSpatial.Points == null) { New.GeoSpatial.Points = new List <BriefItem_Coordinate_Point>(); } // Add each point, from the page foreach (Coordinate_Point thisPoint in geoInfo2.Points) { // Create the new point BriefItem_Coordinate_Point cPoint = new BriefItem_Coordinate_Point { Latitude = thisPoint.Latitude, Longitude = thisPoint.Longitude, Altitude = thisPoint.Altitude, Label = thisPoint.Label, FeatureType = thisPoint.FeatureType }; // Add it New.GeoSpatial.Points.Add(cPoint); } } } } return(true); }