The vertical distance from the CURB LEVEL to the highest point of the roof beams in the case of flat roofs, or to a point at the average height of the gable in the case of roofs having a pitch of more than one foot in four and one-half feet; except that where the curb level has not been legally established, or where every part of the building is set back more than twenty-five feet from a street line, the height shall be measured from the adjoining grade elevation.